WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: Bug on March 30, 2012, 09:23:35 AM

Title: separate style for certain page_id's
Post by: Bug on March 30, 2012, 09:23:35 AM

It is possible to give a separate style to each menu-item
like this
Code: [Select]
<?php show_menu2(2,SM2_ROOT+1,SM2_START,'','<li><a href="[url]" [{if class="[class][page_id]">[menu_title][page_id]</a>','</li>','<ul>','</ul>','',''); ?>
all the menu items get an individual style

- - - - -

it is possible to for instance give a certain behavior to the menu-item based on the level of the menu-items

like this
Code: [Select]
      <?php show_menu2(2,SM2_ROOT+1,SM2_START,'','<li>[if(level < 2){<a class="[class][page_id] navlev[level]">[menu_title]</a>}else{<a href="[url]" class="[class] navlev[level]">[menu_title]</a>}]','</li>','<ul>','</ul>','',''); ?>
all menu-items in menu-levels lower than 2 get an individual style, all menu-items on higer levels get the standard/not individual style ( ofcourse you will need to define the separate styles in ccs)

- - - - - -

what I need is to give a separate behavior to just 1 item in the menu, something tlike this
Code: [Select]
      <?php show_menu2(2,SM2_ROOT+1,SM2_START,'','<li>[if(page_id == 67){<a class="[class][page_id] navlev[level]">[menu_title]</a>}else{<a href="[url]" class="[class] navlev[level]">[menu_title]</a>}]','</li>','<ul>','</ul>','',''); ?>
as you see I changed 'if level=' to 'if page_id =', i hoped this could work but it does not ...

does anyone have a solution?




= = = = =

why?
- I want to create a separation with a line in the middel of the menu
- two menu's is no option as this is the submenus of a rather big menu





Title: Re: separate style for certain page_id's
Post by: Luisehahne on March 30, 2012, 11:38:50 AM
Maybe that helps you

https://forum.WebsiteBaker.org/index.php/topic,23012.0.html

Dietmar
Title: Re: separate style for certain page_id's
Post by: DarkViper on March 30, 2012, 12:05:09 PM
Yes, it's possible to insert spacers into a menue which uses the 'SM2_XHTML'-flag.
For that you can use the 'target' argument.

Create an empty wysiwyg-page and select 'new window' for 'target'

in your sm2_menu()  call you can use the condition if( target==_blank )  to identify spacer-items
Title: Re: separate style for certain page_id's
Post by: Bug on March 30, 2012, 06:20:23 PM
Not if page_id ... But just id

I read the php module files of showmenu ...

Code: [Select]
      <?php show_menu2(2,SM2_ROOT+1,SM2_START,'','<li>[if(id == 67){<a class="[class][page_id] navlev[level]">[menu_title]</a>}else{<a href="[url]" class="[class] navlev[level]">[menu_title]</a>}]','</li>','<ul>','</ul>','',''); ?>

Great!