SID-01666: How can I have page specific menus using TopMenuSkin
| Status: |
Answered |
TWiki version: |
5.0.2 |
Perl version: |
?? |
| Category: |
TopMenuSkin |
Server OS: |
Redhat ?? (sorry, its a VM run by IT group) |
Last update: |
12 years ago |
I am pushing to merge several webs into one common web at our company. users want the abillity to have page headers that modify the
TopMenuSkin menu. (which is default for the web)
When I let a page add another menu bar neither seem to work correctly. I'm looking for a way to allow a page to change or add to the existing top menu.
thanks,
randy
--
Randy Melton - 2013-03-25
Discussion and Answer
The
TopMenuSkinTopBar includes the
WebTopMenu if it exists in the current web, else it includes the default
TopMenuSkinDefaultWebTopMenu.
You can get per-page menus if you customize your web-specific
WebTopMenu. After
%INCLUDE{%SYSTEMWEB%.TopMenuSkinTopicMenu}% add this conditional:
%IF{
"istopic '%CUSTOMTOPICMENU%'"
then="$percntINCLUDE{%CUSTOMTOPICMENU%}$percnt"
else="<nop>"
}%
Now you can create custom topic menus as bullet lists, where top level bullets are pulldowns, and second level bullets are pulldown items. To activate a custom topic menu you can define a CUSTOMTOPICMENU preferences setting in a topic containing the name of the custom topic menu topic.
What do you use TWiki for at work? Do you want to write a case study blog post on TWiki.org? See some
BlogIdeas.
--
Peter Thoeny - 2013-03-25
Thanks for the quick answer. I'll test this tomorrow and report my results here.
--
Randy Melton - 2013-03-25
this is what I ended up with:
%INCLUDE{%SYSTEMWEB%.TopMenuSkinTopicMenu}%
%IF{
"istopic '%CUSTOMTOPICMENU%'"
then="$percntINCLUDE{%BASEWEB%.%CUSTOMTOPICMENU%}$percnt"
else="<nop>"
}%
it works great if CUSTOMTOPICMENU is defined as:
Set CUSTOMTOPICMENU = CsoApgMenu
but I wanted to have 2 levels of include. So I can %INCLUDE(SomegroupHeader)% that defines (or redefines) system variables for plugins like subversion to be specific to that group. I tried putting the CUSTOMTOPICMENU in that SomeGroupHeader page, but it did not work? it seems that the CUSTOMTOPICMENU must be in the "top" page being viewed for it to work.
What did I get wrong?
thanks,
randy
--
Randy Melton - 2013-03-26
Ok I have narrowed the problem to %INCLUDE not importing variable definitions? (ie any variables defined in an include are not available to the parent)
--
Randy Melton - 2013-03-27
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.