show_menu2: valid XHTML and CSS selectable menus

brofield

Why do you think that I should care what sort of turnaround you are on.

I've already spent uncounted hours writing decent documentation and samples. Look at these things that have been written before. Play with parameters and look at what HTML source is generated by the function if you can't figure it out otherwise (try using the SM2_PRETTY flag to make it easier to read). Use your own initiative and not my time.

<style type="text/css"> .menu-current { background: url(big-arse-picture); } </style>
<?php show_menu2(0, SM2_ROOT, SM2_START); ?>

lleighh2

Don't mean to be a pest/hog but i'm on a tight turnaround.

How do i pull my menu-current class from my css? It places a bg image behind the current menu item.

This is what I have so far:
<?php show_menu2(0SM2_ROOTSM2_START

'<ul>' '<li class="menu">[a][menu_title]</a>''</li>' '</ul>'''''); ?>
   

lleighh2

#193
Quote from: brofield on August 24, 2007, 01:30:28 AM
Probably what you want. Lifted verbatim from the examples site:
http://code.jellycan.com/sm2test/

Root Level Only
show_menu2(0, SM2_ROOT, SM2_START);

Children/Siblings
This is often used when splitting menus between the root menu and a side menu showing the children of the current page. This menu will show all of the children of the current top level menu, but will continue to display the siblings of child pages as well when a lower level menu is selected.
show_menu2(0, SM2_ROOT+1, SM2_CURR+1);

Probably what you do NOT want. Anything that has [if...] embedded in it.

Have fun.

I've been looking over that jelly can site for literally hours and made no sense of it. I'm sorry, just not structured in a way that worked for me.

I changed my code to this:
show_menu2(0, SM2_ROOT+1, SM2_CURR+1) ... just like you said but I only get the children to show in the left side menu not at the top like I want them.

... EDIT ...
Hold the phone! I just discovered that part of the problem was that I had the submenu items set to something other than the Main menu. So now, I'm very close. I'll keep tinkering.

Thanks for your help!!

brofield

Probably what you want. Lifted verbatim from the examples site:
http://code.jellycan.com/sm2test/

Root Level Only
show_menu2(0, SM2_ROOT, SM2_START);

Children/Siblings
This is often used when splitting menus between the root menu and a side menu showing the children of the current page. This menu will show all of the children of the current top level menu, but will continue to display the siblings of child pages as well when a lower level menu is selected.
show_menu2(0, SM2_ROOT+1, SM2_CURR+1);

Probably what you do NOT want. Anything that has [if...] embedded in it.

Have fun.

lleighh2

I'm sorry but I'm just not getting this mod.

I've read through most of this thread and the jellycan sm2 documentation but i'm not a programmer so I just cook book it and copy what works for others.

So far I've been able to cook this up for my top horizontal menu here: http://www.theprocess.com/dev/wb//pages/rates.php.

Okay, I was really happy when I got the mod to show that. Trouble is this isn't what i want. I want the top menu to show a submenu of children only. Not a repeat of the main menu.  Please just alter my code below so that I can just copy it in place.

<?php show_menu2(0SM2_ROOTSM2_CURR+1'','[if(class!=menu){[a][menu_title]</a>}]','','',''); ?>

Here's a page that contains the submenu that i want to appear when you're on the voice talent page only:
http://www.theprocess.com/dev/wb//pages/female-voice-talent.php

I'm in the process of building the site. At least three other pages will have a unique submenu at the top.

brofield

Version 4.2 now available at http://code.jellycan.com/show_menu2/

    * Support for whitespace in conditional formatting
    * Support for boolean AND/OR with multiple tests in conditional formatting

e.g. It is now possible to use something like:
[if ( id == current || class == menu-expand ) { foo } ]

which will output " foo " for the current page or for menus with children. See
http://code.jellycan.com/sm2test/pages/conditional.php
for examples and as always the documentation for full details.

Quote from: BerndJM on August 15, 2007, 01:33:38 PM
Is it a big deal to make $aItemClose and $aMenuClose as format strings like $ItemOpen and $aMenuOpen ?

Yes. A lot of the information that is created for the opening items isn't available at closing time unless I stored it in a stack. I don't see that this should be necessary.

B

BerndJM

Hi brofield,

nice little addition I missed some times before.
No more need to make this if ... if ... if ... if ... "battles" ;-)

One question:
Is it a big deal to make $aItemClose and $aMenuClose as format strings like $ItemOpen and $aMenuOpen ?
Maybe it's a not very often needed thing, but I stumpled in some cases the last time, where it would be very helpfull.

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

brofield

Version 4.1 now available at http://code.jellycan.com/show_menu2/

    * Support for an else clause in conditional formatting.
    * Tested against latest version of WB (2.6.7)

B

Boboga

In reply to http://forum.websitebaker.org/index.php/topic,5836.0.html

I'm also running into the same issue, I'm not a star with CSS but I think the problem is that the 'menu-expand menu-parent' doesn't have an "a href" with it so it breaks the CSS..

Anybody any idea for me how to fix this? :)

gokcer

Especially being able to create UDM4 Popup menus... Most of my customers want to see all submenus as rollover/sliding items in the menu bar. Now i can make it :-D.

Very much thanks to you brofield.

kweitzel

Easiest way ... make 2 menu's (look for multiple menu in forum). Use standard menu call in template, just calling the menu numbers.

Harder way ... read the documentation of show menu 2 and make the relevant page_ids the starting point.

cheers

KLaus

nickleermans

#184
I've tried many combinations of the code but I can't find the right one.

I have the following:

Topic 1
- Sub Topic 1a
- Sub Topic 1b
- Sub sub Topic 1ba
Topic 2
- Sub Topic 2a
- Sub Topic 2b
- Sub sub Topic 2ba
- Sub sub Topic 2bb

What I want is:

When you are in one of Topic 1's Children (Sub Topic 1a, - Sub Topic 1b or Sub sub Topic 1ba) then I want the menu to show all of the children of 1.

When you are in one of Topic 2's Children (Sub Topic 2a, - Sub Topic 2b, Sub sub Topic 2ba or Sub sub Topic 2bb) then I want the menu to show all of the children of 2.

The result has to be that there are 2 menu's: one with all the children (and sub children) of Topic 1 and one with all the Children (and sub children) of Topic 2.

I hope that someone know what I mean and have an answer!  :-D

Danko


ruebenwurzel

Hello,

the show_menu2 function is independend from the language. Pagenames and Menutitles are generated from the core files of WB. If you have issues with this maybe this link is helpfull:

Quotehttp://forum.websitebaker.org/index.php/topic,5730.msg37501.html#msg37501

It is a german thread but the attached files should solve all language issues. If you have installed wb 2.6.5 you can download the zip package from this post, unzip and overwrite the files on your hist with the new ones. All pages wich are created after this "upgrade" should look ok.

Matthias

Danko

Does this snippet support foreign language?
When I key in Chinese text, it shows code instead.
(btw, Chinese text appears OK in content area)

Thanks for helping.

brofield

Takes a lot more to offend me than that. Without concrete examples of what is wrong with something and suggestions for how it might be fixed then criticism is usually not constructive.

2 menus = 2 calls to sm2 = 2 sets of parameters.

i.e.
menu 1 = show_menu2( .. normal menu tags .. );
menu 2 = show_menu2( .. empty menu tags .. );

I don't see the problem.

hobo_geek

Ok I think their might be some confusion here about what I'm attempting to do. So I'll attempt to clear it up.

I want to have two menus in my baker template such as:

1. One menu created by the default   

$aItemOpen     = '
  • [a][menu_title]</a>'
    $aItemClose     = '</li>',

    2. The other which is an option list of all the pages available.

    As you can see I can't change the $aItemOpen and $aItemClose to empty tags as the first menu won't work. I'm sorry if you were offended by my suggestion of the documentation being confusing for me as it took me quite a while to figure out exactly what you meant by the more advanced features. However, thank you to you both for helping me with my ongoing problem :-D

brofield

Why don't you have a look at the HTML that sm2 is generating? If you are still trying to solve the original problem, then follow kweitzel's advice and add entries for $aMenuOpen and $aMenuClose. Read the perhaps-confusing-but-all-you-got documentation for details of what these do. From your sample before you probably just want empty strings for these tags.

hobo_geek

Sorry its taken me so long to get back to you been busy with project work so have had little time to work on this.

I forgot to mention that I have other menus that use that need the SM2 to create a list. From what I've read from the documentation would I be correct in saying that I'd need need to define $aTopItemOpen in the include.php?

Sorry I'm new to the show_menu2 module and I get the basics of it but sometimes the documentation I think can be very unclear/confusing for newcomers. 

kweitzel

#176
Currently your SM2 should still try to create a list, since you don't pass on special tags for the $aMenuOpen and $aMenuClose

You should open and close a form around it, at the end, an Optionlist is a form element. And don't forget the "select" tag around it as well ... pass it on via the SM2 variables. They are explained in the readme file.


cheers

Klaus

hobo_geek

So I have a small problem. I'm using show_menu2 to create a dropdown box menu. However, I can't seem to get it to work. I know I must be doing something stupid with the <option> in it. Here is the code:

<select name="drop_menu">
<?php show_menu2(0SM2_ROOTSM2_START'<option value="[menu_title]">[a][menu_title]</a>''</option>'); ?>
</select>


Any help will be appreciated. Thanks.

gavjof

Nice one, I never read that far  :oops:
All good now.

brofield

Quote from: gavjof on March 14, 2007, 02:13:02 PM
I'm using the following to show a site map for current level pages complete with descriptions:
... using SM2_ALLINFO ...
... but when I try using another template it only returns.
[description=UNKNOWN]

As is written clearly in the documentation at
http://code.jellycan.com/files/show_menu2-README.txt

SM2_ALLINFO   
Load all fields from the page table of the database. This will result in quite a lot of memory being used and is not recommended, however it will make keywords, descriptions, and other fields available. This data is not loaded by default. NOTE: This flag must be used on the *FIRST* call to show_menu2 *for this menu ID*, or in combination with SM2_NOCACHE otherwise it will have no effect.

Make sure that SM2_ALLINFO is being used in all calls to sm2 in the template.

Brodie

gavjof

I've done a few tests and discovered it's down to the code used for the breadcrumbs:-

Code used from demos, http://code.jellycan.com/sm2test/

show_menu2(0, SM2_ROOT, SM2_MAX+2, SM2_CRUMB, ' > [a][menu_title]</a>', '', '', '', '<strong>You are here:</strong> [a][menu_title]</a>');


If I remove this menu call the other menu (showing the [description] variable) works fine.

gavjof

#171
A new one I'm busy designing for a client.
I also tried the "allcss2" which did not work either.

Like I say - It worked with the default "round" template.
But that template uses "page_menu" to call it's menu. It could be that by using "show_menu2" in other places (in this new template) it is affecting the menu call that uses the [description] variable.

**EDIT**
Yes, all the pages do have a description and I works accordingly in the *round* template.