[pmwiki-devel] understanding pagelist default parameters

Simon nzskiwi at gmail.com
Sun Mar 22 13:57:57 PDT 2026


Thankyou, I now see the problem (I think?)

I would have expected, say, in this statement (from a SideBar)
(:pagelist name=A* fmt=Songbook.SideBar#listbyletter category={*$:genre} :)
the parameter category= NOT to morph into a search string if  the page text
variable {*$:genre} is not defined on a page body.

It seems to me that if a user desires a search string of "category=" they
should quote it.

thanks

Simon



On Fri, 20 Mar 2026 at 20:14, Petko Yotov <5ko at 5ko.fr> wrote:

> The argument category= without anything after the "=" is considered a
> search string and the pagelist shows pages containing the literal string
> "category=" in the page text.
>
> You can use category="" but this overrides your template default.
>
> If you populate this argument from a page text variable, there are
> $DefaultEmptyPageTextVars and $DefaultUnsetPageTextVars:
>
>    $DefaultUnsetPageTextVars['genre'] = '*';
>    $DefaultEmptyPageTextVars['genre'] = '*';
>
> This should work for the pagelist argument, but may not work well if you
> display the {*$:genre} variable elsewhere.
>
> Otherwise you could have a conditional with 2 pagelists, something like
> this:
>
> (:if332 empty "{*$:genre}":)
> (:pagelist ... category=*:)
> (:else332:)
> (:pagelist ... category="{*$:genre}":)
> (:if332end:)
>
> Petko
>
> --
> If you upgrade :  https://www.pmwiki.org/Upgrades
>
> On 20/03/2026 06:27, Simon wrote:
> > I have a test here:
> > https://www.pmwiki.org/wiki/Test/PagelistWithCategoryParameter
> >
> > It has defaults, viz
> >
> > (:template defaults group=Cookbook order=name category="*" count=5 :)
> >
> > I'm trying to understand why
> > (:pagelist name=W* fmt={$FullName}#listbyletter :)
> > appears to give a different result from
> >
> > (:pagelist name=W* fmt={$FullName}#listbyletter category= :)
> >  thanks
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20260323/6047d9cf/attachment.html>


More information about the pmwiki-devel mailing list