[pmwiki-users] Wiki trail in template header and footer
DaveG
pmwiki at solidgone.com
Sun Dec 11 16:37:22 CST 2005
Spoke too soon. What we end up with is a trail with no prev/next links.
I get the text where I want it, but I suspect the trails.php isn't able
to function from inside a template, as trail.php looks for the name of
the template in the trail base list, can't find it, and thus shows no
prev/next links.
~ ~ Dave
DaveG wrote:
> I now have it working. Here's what I did:
>
> 1] Put this markup in config.php:
> Markup('^trail:', 'directives',
> '/^trail:(.*)/e',
> "\$GLOBALS['TrailSource']='$1'");
>
> 2] In your template PHP file add a function:
> function ShowTrail() {
> if ($GLOBALS['TrailSource']!=""){
> echo MarkupToHTML($pagename,"<<|[[".$GLOBALS['TrailSource']."]]|>>");
> }
> }
>
> 3] In your template TMPL file add the following wherever you want the
> trail to appear:
> <!--function:ShowTrail-->
>
>
> * I'd like to know how to refer to $GLOBALS direct from the .tmpl file.
> Is it possible?
>
> * Is this a reasonable way to achieve my original goal of having a user
> defined variable displayed in more than one place on a page?
>
> It took forever to work that out, despite frequent hints from PM. I'd
> like to document this in a generic way (how to display page variables on
> your wiki). What's the appropriate place to put this info?
>
> ~ ~ Dave
>
> DaveG wrote:
>
>> I may be using this wrongly. Declaring the markup below will create a
>> variable. *How do I reference it in the tmpl?* I tried a few ways, but
>> all failed, so I'm not sure if I'm using the markup incorrectly or
>> referencing incorrectly.
>>
>> I'm using this markup:
>> > Markup('^trail:', 'directives',
>> > '/^trail:(.*)/e',
>> > "\$GLOBALS['TrailSource']='$1'");
>>
>> In a wiki-page I put:
>> trail:xyz
>>
>> The output of the page displays "xyz".
>>
>> I tried referencing using:
>> $GLOBAL['TrailSource']
>> and
>> <!wiki:$GLOBALS['TrailSource']-->
>> and
>> <!markup:$GLOBALS['TrailSource']-->
>>
>> At this point you can probably tell, I have no clue :)
>>
>> ~ ~ Dave
>>
>> Patrick R. Michaud wrote:
>>
>>> On Sun, Dec 11, 2005 at 12:37:04PM -0500, DaveG wrote:
>>>
>>>> I know how to create a markup rule. That part I'm not sure about is
>>>> creating a variable that can be referenced in the template. I
>>>> imagine it's something like:
>>>> Markup('^trail:', 'directives', '/^trail:(.*?)$/',
>>>> '$TrailSource="$1";');
>>>> That would allow someone to enter: "trail: Group/Pagename". And then
>>>> simply reference $TrailSource in the tmpl file. Close?
>>>
>>>
>>>
>>>
>>> Close. It's actually:
>>>
>>> Markup('^trail:', 'directives',
>>> '/^trail:(.*)/e',
>>> "\$GLOBALS['TrailSource']='$1'");
>>>
>>> Pm
>>>
>>
>> _______________________________________________
>> pmwiki-users mailing list
>> pmwiki-users at pmichaud.com
>> http://host.pmichaud.com/mailman/listinfo/pmwiki-users
>>
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://host.pmichaud.com/mailman/listinfo/pmwiki-users
>
More information about the pmwiki-users
mailing list