[Pmwiki-users] Ignoring variables in a template file

Val Sharp val
Wed Nov 3 04:27:48 CST 2004


Patrick R. Michaud, on 19.10.04 16:05, wrote:
> 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 ...
> 
> ...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 .


My impression is that both methods require hard-wiring the breadcrumbs 
... any page changes (creation/deletion) would require changing the 
trails or $BreadCrumb variables.

I've just converted my JavaScript solution to PHP, and it makes the 
breadcrumbs for each page on the fly.

I'm using a single variable to hold the first-level group name for 
each second-level group (- simply assigning it in the local config 
file for the second-level group), and using that to create a 
breadcrumb trail of 'Home > FirstLevelGroup > $Group > $Name'

(working at 
<http://cgi.davemaclaren.plus.com/valsharp/pmwiki.php/Articles/DynamicAccessToCSS>)

That means the only thing that needs doing to create a subgroup is to 
create the once-only entry in its local config file, linking it to its 
parent group, when the subgroup is created. (Of course, this method 
will only work to one subgroup level, but that's all I wanted ... for 
now  :-)

Not knowing any better, I though I'd make use of the defunct 
$DefaultTitle variable for this, because if it's not set in the group 
local config file for that page, then it's value on each page is 
always '$DefaultTitle ... so if the value is '$DefaultTitle' I know 
there's no first-level group assigned, and simply omit that from the 
breadcrumbs, giving 'Home > $Group > $Name'

My knowledge of variables and their scope in a PHP environment is 
sketchy to say the least ... so, am I making use of a legacy from the 
existing $DefaultTitle variable, or would any variable I created 
behave in the same way in this context?
i.e. at the moment, where does the default value of '$DefaultTitle' 
come from when each page is served?


-- 
Best regards,
Val Sharp - Edinburgh
   Wiki site at <http://cgi.davemaclaren.plus.com/valsharp/pmwiki.php>
            aka <valsharp.co.uk>



More information about the pmwiki-users mailing list