[pmwiki-devel] FPLTemplate() Revision

Hans design5 at softflow.co.uk
Tue Feb 17 10:58:22 CST 2009


Tuesday, February 17, 2009, 11:22:35 AM, Dominique wrote:

> So what about ? :)

> if(!$ttext) {
>   global $FPLTemplateError;
>   SDV($FPLTemplateError, "(:template first:)%red%Error: Unable to
> retrieve pagelist template \$template");
>   $ttext = str_replace('$template', $template, $FPLTemplateError);
> }

Certainly this is much better as a global var!
It could be set to null for no error message, or internationalized,
or customised in different styles etc.

I am not sure though if it could not be classed as a superfluous
feature, as it is a non-critical error.

I am wondering about another add-on template variable to be built into
FPLTemplateFormat alongside {$$PageCount}, {$$GroupCount} and
{$$GroupPageCount}:
If chunks of a pagelist are displayed, {$$PageCount} will always
start at 1 and go up to the number of items shown ($count value).
To get a continuous index number one needs another var, perhaps call
it {$$IndexCount}.
This is initialized as
     $indexcount = $opt['start']-1;
and then incrementally increased like $pagecount in the page loop.

An index number like this could be done in the template with use of a
'sum' markup expression, summing the {$$start} and the {$$PageCount},
but it would be smarter done within the FPLTemplateFormat
sub-function.



Hans




More information about the pmwiki-devel mailing list