[Pmwiki-users] Ignoring variables in a template file

Patrick R. Michaud pmichaud
Tue Oct 19 09:05:25 CDT 2004


On Tue, Oct 19, 2004 at 03:44:58PM +0100, Val Sharp wrote:
> I'm trying to give the appearance of a sub-level of groups, in the 
> form of breadcrumb links.
> 
> Try 1 involves the use of javascript in my template, and what I want 
> is to compare the value of variable $DefaultTitle with the string 
> "$DefaultTitle"
> 
>    if ('$DefaultTitle' != '$DefaultTitle') ...etc
> 
> Trouble is, when the template's parsed, both are converted to the 
> value of the variable. Is there a way to stop the second instance 
> being parsed?

Here's a cheater's hack to do it:  In your template, do

     if ('$DefaultTitle' != '$ADefaultTitle') ...etc

and then in your config.php, do

   $ADefaultTitle = '$DefaultTitle';

Because of the order in which PmWiki processes variable substitutions,
'$ADefaultTitle' will be replaced by '$DefaultTitle' *after* PmWiki
has already done the normal $DefaultTitle substitutions.

...but it ought to be possible to do breadcrumb links without having
to use JavaScript!  For example, one can do breadcrumbs with
WikiTrails and the ^|TrailPage|^ markup.  Or, one can create a
special "$BreadCrumb" variable in PHP that holds the bread crumb
text and is then substituted into the template.  This is what I
did for http://www.sci.tamucc.edu/wiki/COSC .

Pm



More information about the pmwiki-users mailing list