[pmwiki-users] Question about expanding menu (w/o additional scripts) :)
Vladimir Grigor
vgrigor at gmail.com
Sun Sep 16 14:02:22 CDT 2007
Vladimir Grigor wrote:
Solution should be quite simple to this problem, but I can't make this
system do what I want.. :)
I came to this solution(it doesn't work yet ):
1) script in Site.SideBar calls
(:pagelist fmt=#sidebar name=Research.* :)
so only pages from 'Research' group are selected;
2) script in Site.LocalTemplates
[[#sidebar]]
...
(:if equal {$ReqPDir} {=$Group} )
* [[{=$FullName}|+]]
(:if:)
...
[[#sidebar]]
It checks if group of current page is the same as group of
$RequestedPage. If it is, then second level of links of menu is shown.
I didn't find way to extract only group part of $RequestedPage while in
Site.LocalTemplates. So I constructed this var (it should contain group
of requested page, if any) in config.php:
$FmtPV['$ReqPDir'] = substr($FmtPV['$RequestedPage'], 1,
strpos($FmtPV['$RequestedPage'], '.') - 1); //doesn't work!!!
Need help... Please correct me
> 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 :)
> %sidehead% [[{=$Group}]]
> (:template each:)
> * [[{=$Name}]]
>
> [[#sidebarend]]
> ========= code ends
>
> There is only one problem with this code - it doesn't work :)
>
> Suggestions, please...
More information about the pmwiki-users
mailing list