[pmwiki-users] New Recipe: StringReplace

Hans design5 at softflow.co.uk
Mon Mar 12 03:40:06 CDT 2007


Monday, March 12, 2007, 6:16:38 AM, SteP wrote:

> You're right, I had just figured that out. However, when I change it to
> lowercase, no links are displayed on my page Go.Travel page, the exact
> markup I'm using is

> (:if equal '{{$Name}/Miami$:Dest}' '0':)(:stringreplace str1=":Dest:0:"
> str2=":Dest:1:" label="Go to Miami" target="{$Name}/Miami" redirect=0:)
> (:if equal '{{$Name}.Miami$:Dest}' '1':)(:stringreplace str1=":Dest:1:"
> str2=":Dest:0:" label="Cancel Miami" target="{$Name}.Miami" redirect=0:)

target="{$Name}.Miami" or target={$Name}.Miami resolving fine in the
link markup of StringReplace.

I found one problem in StringReplace in the redirection. At the bottom
of the script I had to replace Redirect($currpage);
with HandleBrowse($currpage);
otherwise PmWiki loads a blank white page with a link to the current page.
But this is a side issue I investigate further.

The problem with the link not showing lies in the conditional test:
Although {{$Name}.Miami$:Dest} displays the PTV correctly from group
{$Name} page Miami, the same variable does not work in the
conditional. Note: I always use dots {{$Name}.Miami$:Dest} rather than
{{$Name}/Miami$:Dest}.

You can test this by replacing {$Name} with the page name.
Then the link appears. Perhaps you don't need to use a page variable
inside a page text variable inside the conditional.

Otherwise perhaps ask again on the list about the problem
using PV inside PTV inside conditionals.


Hans




More information about the pmwiki-users mailing list