[pmwiki-users] PTV in Page List Template
Petko Yotov
5ko at 5ko.fr
Wed May 21 00:37:02 PDT 2025
> *{=$FullName}: {=$:Bu{$BaseName}Pos}
This here probably needs to be {=$BaseName} not {$BaseName}, but I'm not
sure if it will work.
For your needs, it may be simpler to add a new custom page variable that
does your processing outside of the markup:
$FmtPV['$MyBuPos'] = 'FmtMyBuPos($pn)';
function FmtMyBuPos($pn){
$base = PageVar($pn, '$BaseName');
$ptv = "Bu{$base}Pos";
return PageTextVar($pn, $ptv);
}
Then in the pagelist template, use {=$MyBuPos} instead of
{=$:Bu{=$BaseName}Pos}.
Petko
--
If you upgrade : https://www.pmwiki.org/Upgrades
On 20/05/2025 22:01, Martin Cuno wrote:
> Hello bright minds!
>
> A question about page list templates: You can use them to query PTVs
> from the target pages, using something like this syntax:
>
> [[#slv02]]
> *{=$FullName}: {=$:Bu70-01Pos}
> [[#slv02end]]
>
> I'm now looking for a way to add part of the PTV name (in the example:
> 70-01) as a variable to the page list template. This "70-01" is the
> $BaseName of the current page. But if I write:
>
> [[#slv02]]
> *{=$FullName}: {=$:Bu{$BaseName}Pos}
> [[#slv02end]]
>
> then this is rendered in the view as "{=$:Bu70-01Pos}", but it doesn't
> give me the value of this PTV. Although I can even sort the page list
> by these values!
>
> Is it hopeless because the processing order makes it impossible, or is
> there a trick?
>
> The background is, of course, more complicated: I want to outsource
> the page list template (for many such pages) to a central location.
>
> Anyone have any ideas?
>
> Martin, Siegen, Germany
More information about the pmwiki-users
mailing list