On Dec 9, 2007 11:40 PM, Hans <design5 softflow.co.uk> wrote:
> Sunday, December 9, 2007, 9:11:40 PM, Dominique wrote:
>
> > Could you please give the definition of the
MarkupExpr function which
> > is triggering this error?
>
> Oh i see it is mostly my own definition. But I am not
quite sure.
> Here is the definition:
>
> # {(catlist PAGENAME SEPARATOR)} (arguments optional)
> $MarkupExpr['catlist'] = 'CategoryList($pagename, $args[0],
$args[1])';
>
> function CategoryList($pn, $arg='', $sep=',') {
> global $CategoryGroup;
> if(!$arg=='') $pn = MakePageName($pn, $arg);
> if($sep==NULL) $sep = ",";
> $page = RetrieveAuthPage($pn, 'read', true);
> $pat = '/\[\[\!(.*?)\]\]/';
> $text = preg_replace('/\(:(.*?):\)/'
,"", $page['text']);
> if(preg_match_all($pat, $text, $matches)) {
> foreach($matches[1] as $i=>$m)
> $catlist[] = MakePageName($pn,
$CategoryGroup.".".$m);
> return implode($sep, $catlist);
> }
> }
>
> I just added the to args[0] , args[1], thanks for the
hint.
> This cuts down the errors, but I still get some:
>
> using {(catlist)} without arguments I get these
errors:
>
> Notice: Undefined offset: 3 in
...cookbookmarkupexprplus.php on line 106
>
> Notice: Undefined index: # in
...cookbookmarkupexprplus.php on line 119
>
> and when I use {(catlist )} (extra space added) I get
>
> Notice: Undefined index: # in
...cookbookmarkupexprplus.php on line 119
>
> and when I use {(catlist '')} I get no errors.
>
> Please tell me if I can improve the definition, or if
the error comes
> form the script. It seems that
> $x = $argp['#'];
> in the script can be undefined.
>
>
> Hans
>
>
That's funny, my initial remark was applying to the
MarkupExprPlus
script itself ;)
markupexprplus.php(106) should read:
list($repl, $dummy, $func, $params) = $match;
and markupexprplus.php(119):
$x = $argp['#']; $args = array();
(the same consideration applies to markupexpr.php)
The script has just been updated on pmwiki.org
--
Dominique
_______________________________________________
pmwiki-devel mailing list
pmwiki-devel pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
|