[pmwiki-users] Question about expanding menu (w/o additional scripts) :)

Vladimir Grigor vgrigor at gmail.com
Mon Sep 17 07:16:19 CDT 2007


Thanks Martin!

I found my mistake - it was lack of closing semicolon in (:if:) 
construction. :)

Following code does expanding menu that I wanted:
1)Site.SideBar has this line for every 1st level menu item:
(:pagelist fmt=#sidebar name=GroupName.*,-RecentChanges,-HomePage  :)
2)Site.LocalTemplates has this code for #sidebar:
[[#sidebar]]
(:if equal {<$Group}:)
 >>fplsidebar<<
(:if ! equal {<$Group} {=$Group}:)
%sidehead% [[{=$Group}]]
(:if equal {$Group} {=$Group} :)
* [[{=$FullName}|+]]
(:if equal {>$Group}:)
 >><< (:if:)
[[#sidebarend]]

The same code but expressed in (:template:) doesn't work for me.
Following code:
[[#sidebar]]
(:template first:)
 >>fplsidebar<<
(:template first {=$Group}:)
%sidehead% [[{=$Group}]]
(:if equal {$Group} {=$Group} :)
* [[{=$FullName}|+]] (:ifend:)
(:template last:)
 >><<
[[#sidebarend]]

produces following lines in sidebar:
(:template first:)
(:template first Research:) Research (:template last:)
(:template first:)
(:template first Research:) Research (:template last:)
(:template first:)
(:template first Research:) Research (:template last:)

Thanks Martin :)

Martin Fick wrote:
> --- Vladimir Grigor <vgrigor at gmail.com> wrote:
> 
>> Hi dear All! Need you help...
>>
>> I want to implement 2 level menu in sidebar. 2nd
>> level items link to pages in corresponding groups.
>>
>> Suppose there are these pages in wiki:
>>
>> Main.Homepage
>> Research.Research
>> Research.Projects
>> Research.Funding
>> Research.Join us
>> Contacts.Contacts
>>
>> And if user is on Main.Homepage (s)he sees following
>> menu:
>> -------
>> Homepage
>> Research
>> Contacts
>> =======
>>
>> But if user browses pages in group Research
>> (Research.*) then menu is this:
>> -------
>> Homepage
>> Research
>>   *Projects
>>   *Funding
>>   *Join us
>> Contacts
>> =======
>>
>> I've read (probably) all (and recipes in
> cookbook.menues also) what I
>> could find about "expanding menu". It should be
> possible to do it by
>> Local Templates mechanism.
>>
>> I try to implement it in the following way:
>>
>> -------- code in Site.SideBar starts
>> %sidehead% [[Main/HomePage]]
>> (:pagelist fmt=#sidebar order=title
>> name=Research.*,-HomePage :)
>> * [[Contacts.Contacts]]
>> ========= code ends
>>
>> -------- code in Site.LocalTemplates starts
>> [[#sidebar]]
>>
>> (:template defaults order=name:)
>> (:template first :)
> 
> you probably want
>  (:template first {=$Group} :)
> 
>> %sidehead% [[{=$Group}]]
>> (:template each:)
>> * [[{=$Name}]]
>>
>> [[#sidebarend]]
>> ========= code ends
>>
>> There is only one problem with this code - it
>> doesn't work :)
> 
> What specifically doesn't work?  First make sure that
> you get the set of pages  that you expect returned by
> the pagelist (maybe with a default template), then
> make sure that it filters them properly with your
> template.
> 
> -Martin
> 
> 
> 
> 
>       ____________________________________________________________________________________
> Check out the hottest 2008 models today at Yahoo! Autos.
> http://autos.yahoo.com/new_cars.html




More information about the pmwiki-users mailing list