[pmwiki-users] Pagelist converts & in Title into &

Dominique Faure dominique.faure at gmail.com
Thu Mar 1 10:26:11 CST 2007


On 3/1/07, kirpi at kirpi.it <kirpi at kirpi.it> wrote:
> > "&" in titles like (:title Benson & Hedges:) always renders properly.
> > The same is not true in pagelist, it seems.
> >
> > I defined a jumpbox this way
> >
> > (:if false:)
> > [[#jumpbox]]
> > (:input jumpbox value="{=$PageUrl}" label="{=$Title}":)
> > [[#jumpboxend]]
> > (:if:)
> > (:pagelist group=Somegroup fmt=#jumpbox:)
> >
> > but in the list I get "Benson &amp; Hedges" which, though clear to me,
> > is deceiving (at times hardly usable) for most common users.
> >
> > I knew that "&" is converted in page names, but not in titles.
> > Why this behaviour?
> > Is there a way to let it behave the way it should?
>
>
> In search of a solution, I tried and write this line into local.php
>
> $FmtPV['$Cleantitle'] = 'preg_replace("&(amp|#38);", "&", $Title)';
>
> To my mind, this would set a $Cleantitle variable where ampersand in
> $Title is properly rendered as "&".
> Then, in the jumpbox definition I wrote
>
> (:input jumpbox value="{=$PageUrl}" label="{=$Cleantitle}":)
>
> Thus switching from label="{=$Title} to label="{=$Cleantitle}
> Evidently I was wildly messing things, for I got a long list of errors:
>
> Warning: preg_replace() [function.preg-replace]: No ending delimiter
> '&' found in /web/htdocs/www.kirpi.it/home/wiki/pmwiki.php(651) :
> eval()'d code on line 1
>
> Failure.
> I wish I was a programmer...
>
> Anyway, I remember Pm writing, some time in the past, that Title has
> some issues.
> Has this "&" issue something to do with that?
>
> Maybe the "silence" I hear about this thread is due to the fact that,
> at the moment, there is no solution?
>

perhaps you could try something like:

$FmtPV['$Cleantitle'] =
 'str_replace(array("&lt;","&gt;","&amp;"),array("<",">","&"),
PageVar($pn,"$Title")';

Regards,
Dom



More information about the pmwiki-users mailing list