show_menu2: valid XHTML and CSS selectable menus

BerndJM

Hi,
if I understand your SM2 call right, you want to have a  | only between the menu-points but no leading | before the first?
Your SM2 call isn't complete, you missed the last parameter
show_menu2(0, SM2_ROOT, SM2_START, SM2_ALL, ' | [a][menu_title]</a>', '', '', '', '[a][menu_title]</a>', '');

Regards Bernd
In theory, there is no difference between theory and practice. But, in practice, there is.

simmy2000

thanks for your answer.. i was tried this example

show_menu2(0, SM2_ROOT, SM2_START, SM2_ALL, ' | [a][menu_title]</a>', '', '', '', '[a][menu_title]</a>');

but without success...

can you tell me at least if is the right way??

thanks!

ruebenwurzel

Hello,

please read here:

http://code.jellycan.com/sm2test/

or here:

http://css.maxdesign.com.au/

You can add the brackets to the menu_call or you can style your list with css to use brackets.

Matthias

simmy2000

hi..one question:
i need to add a symbol (like ">" or "-") before every voices of my menu.

the code is this:       <div id="menu">
       <?php show_menu2(1,SM2_ROOTSM2_START?>
      </div>


but i don't be able to add this code portion..
can you help me?

now my menu is like that:

MENU1 MENU2 MENU3

and i would change it in

> MENU1 > MENU2 > MENU3

thanks!

Lotus

Quote from: brofield on January 05, 2009, 10:44:38 AM
The multiple menu code is only barely tested because I really don't see the point in it.

Well, i have this menu of corporate and informative stuff. The corporate pages are home, contact, find us, etc. and the informative pages are what services the company do. Informative pages has children and corporate dont.
To separete these two kind i am using two menus so i can style them slightly diffrent making it more obvious what is what.

Lotus

Ah..ok..yes I think so too, you also get a great overlook of pages in admin.

Thanx for all help brofield and happy new year from Sweden!  :-D

brofield

I mean using a single menu tree with multiple "roots". Like it appears that you are doing (but mixing it with multiple menus). i.e. http://help.websitebaker.org/pages/en/advanced-docu/designer-guide/multilingual-websites.php

EN
...
JA
...
FR
...

Or similarly...

Top
- main menu (e.g. page_id = 12)
   - page 1
   - page 2
 - util root (e.g. page_id = 32)
   - util page 1
   - util page 2
- other root  (e.g. page_id = 38)
    - other page 1
    - other page 2

show_menu2(0, 12); // main menu
show_menu2(0, 32) // util menu
show_menu2(0, 38) // other menu

Lotus

I successfully managed to get the behaviour i wanted by specifying page_id as root:
<?php show_menu2(2,); ?>
But then the EN part doesn´t work :-), but i think som PHP can take care of that.

This is interesting though..
Quote from: brofield on January 05, 2009, 10:44:38 AM
..I've always felt that the multiply rooted menu is the best way to implement multiple menus.
Do you mean that every menu shall be rooted from level 0 (zero)?

brofield

If it didn't make a difference then it isn't the caching.

The multiple menu code is only barely tested because I really don't see the point in it. I've always felt that the multiply rooted menu is the best way to implement multiple menus.

Sorry, but I don't have anymore suggestions at the moment and no time to investigate.

Lotus

Thanx for your answer brofield, but i could´t get it to work.
Tried the obvius and several other..
<?php show_menu2(2,SM2_ROOT+1,SM2_START+1,SM2_ALL|SM2_NOCACHE ); ?>

I just will have to do something else about the menu..

brofield

Try passing the SM2_NOCACHE flag to the calls and see if that fixes the problem. This flag causes it to re-read all data from the database for each call. It may be a caching problem.

Lotus

Got a small problem, pages assigned to $menu[2] only shows if i use $aStart  = SM2_CURR.

info.php
$menu[1]    = 'Meny_ovre';
$menu[2]    = 'Meny_undre';


index.php

<?php show_menu2(1,SM2_ROOT+1,SM2_START+); ?>
<?php show_menu2(2SM2_CURR ); ?>


Page layout (The page is multilingual)

SE <- Menulink to "PageSE1"
-PageSE1 <- Assigned to $menu[1]
-PageSE2 <- Assigned to $menu[2]
--PageSE2:1 <- Assigned to $menu[2]
GB <- Menulink to "PageGB1"
-PageGB1

etc..


Problem
When using this configuration and pressing "PageSE2:1" all pages from the parent level disappear in $menu[2].
Using $aStart = SM2_ROOT+1 (as in $menu[1]), as i would prefer using, returns no menu at all.

I really need the parents to stay.


vyni

You are welcome.

Maybe someone else could give You a better solution - but this one is definitly working.
Now You are able to style every single button, if You want.

cu

bupaje

Thanks again. After trying a few things what seems to work is


show_menu2(
        $aMenu          = 0,
        $aStart         = SM2_CURR+1,
        $aMaxLevel      = SM2_ALL,
        $aFlags         = SM2_ALLINFO|SM2_PRETTY,
        $aItemOpen      = '<li class="[class] button[page_id]"><a href="[url]" target="[target]" [if(level==0){class="topitem"}][if(level==1){class="subitem[page_id]"}]>[menu_title]',
        $aItemClose     = '</a></li>',
        $aMenuOpen      = '<ul>',
        $aMenuClose     = '</ul>',
        $aTopItemOpen   = false,
        $aTopMenuOpen   = false
        );




then I can

<style type="text/css">.button167 .subitem167{font-weight: bold}</style>

Probably not the best solution as I will have to add css to each page with the menu rather than a global type solution but seems to be the only sure way to get those first top elements. With the [sib] 1 thru 5 button 1 is applied at the first item if subitems and so on. My advanced css aren't existent. However this works so I am very grateful for your help - thanks!

vyni

#255
Hmm, I havn´t tried yet - but maybe yes. But than You must use the SM2_ALLINFO - otherwise the page_id isn´t available.

Just check out the help-page for sm2 how to set sm2_allinfo.


regards from Himberg

uups - just saw it´s already set - so try a class like butt[page_id] - maybe it works.

Edit: Yes, just set something[page_id] and You get somthing11 or whatever the page_id is.

bupaje

Ooooh, thanks! You da man. I see the button1 ...button5 etc. Should be able to do it now.

Can I ask one more question? Is it possible to use the page id somehow in show_menu so instead of [sib] I can use something like [pageid]? The button numbers assigned via sib may change as I add items correct? I figure if it is possible I'd like to use the page ids which won't change.

Thanks a million.

vyni

#253
So try this:

<?php    show_menu2(
        $aMenu          = 0,
        $aStart         = SM2_ROOT,
        $aMaxLevel      = SM2_START,
        $aFlags         = SM2_ALLINFO|SM2_PRETTY,
        $aItemOpen      = '<li class="[class] button[sib]"><a href="[url]" target="[target]" [if(level==0){class="topitem"}][if(level==1){class="subitem"}]>[menu_title]<span>&raquo;[description]</span>',
        $aItemClose     = '</a></li>',
        $aMenuOpen      = '<ul>',
        $aMenuClose     = '</ul>',
        $aTopItemOpen   = false,
        $aTopMenuOpen   = false
        ); ?>

Please note: I just changed to li-output. I use it with an div-output. So maybe there is a small error, I havn´t tried.

With this You get somthing like ...class="menu-sibling button3"...
You must declare classes for button1 to 5 or whatever You get - look in the source-code

regards

bupaje

Thank you. I confirmed that my first example does not work. Here is my current declaration

show_menu2(0, SM2_CURR+1, SM2_ALL, SM2_ALL|SM2_CURRTREE);

maybe something is wrong here?

Anyway I have tried to add a class as you suggested using the examples on the demo page but have not been successful yet. If it is not too much trouble can you tell me where I should add this code?

Thank you for taking the time to help.

vyni

But You declared exactly

.menu-expand menu-child {........}  ???

And this effected something else?

I can´t believe. But however. So add a new, unique class to the menu, like button[sib], than declare button1 to button5, for each button separately.

$aItemOpen      = '<li class="button[sib] [class]">[a][menu_title]</a>',

And don´t tell me the same.

bupaje

I did try that and others like .menu-top but unexpected different links were affected here and there. I can't seem to isolate just the elements I mentioned.

vyni

Hi bupaje,

so why not use it´s very own classes for that?

photoshop - classes menu-expand menu-child menu-first
flash, References & Web-Design - classes menu-expand menu-child
z-archive - classes menu-child menu-last

I´m not sure, but if You declare .menu-expand menu-child {........}
You´ll get what You´r looking for.


regards from Himberg

bupaje

I have a CSS question on styling show_menu2 elements.

On this page

http://stormvisions.com/pages/library.php

I want to style the following links

Photoshop
Flash
Reference & Inspiration
Web Design

I'm not sure if it is possible with the way I have it laid out. I have been looking at the page source code but am not sure how to select just these elements.

Any help appreciated.


brofield

Updated the version of 4.7 at http://code.jellycan.com/show_menu2/ with the latest version of the german readme.txt that includes some missing text. No other changes.

Cheers,
Brodie

ruebenwurzel

Hello,

thanks for the update of show_menu2. And also thanks to BerndJM for the german translation. Replaced the modul on the addons page with version 4.7 (including the actualisized README.de.txt).

Matthias