WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: brofield on February 20, 2006, 10:20:04 AM

Title: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on February 20, 2006, 10:20:04 AM
Hi,

See http://code.jellycan.com/show_menu2/ for details and updates

show_menu2 is a code snippet that provides a complete replacement for show_menu.

Features
Speed
It should be faster than the existing function as it hits the database exactly once per page load. The builtin function hits the database multiple times per function call. This is at the expense of more memory as all page information is stored locally. Realistically, the memory load is not large.

Flexibility
It can generate menus in many different ways. Covering all of the existing menu's abilities (as far as I know) and adding a few more of it's own.

Valid XHTML
The HTML generated by this function is valid XHTML.

Easy CSS styling
It generates a menu with lots of classes on each element to allow easy styling of the menu via CSS. This should allow the generated menus to be used in pretty much any way, e.g. popups, dropdowns, etc. See websites about CSS menus.

Lists, Tables, Spans, or more
Like the existing function, you can use whatever HTML tag you want to delimit the menu and menu items. UL, OL, DIV, SPAN, TR, etc. Use your imagination.

Menus or Breadcrumbs
All types of menus can be generated as well as breadcrumbs.

Demo
A demo website showing many of the different types of menus that can be created using this function is at http://code.jellycan.com/sm2test/

Documentation
See the website mentioned above for documentation.

Disadvantages
No major disadvantages to using this menu function that I can see, although suggestions are welcome. Minor ones that I can think of are:

Call Signature
It doesn't use the same call signature as show_menu (although it can if you want, just uncomment the include legacy.php line in the include.php file).

Multiple Class Names
IE for Mac has a number of bugs relating to multiple class names on a tag. Major browsers that people actually use will handle it fine though.
Title: Re: pure CSS menus
Post by: Stefan on February 20, 2006, 02:44:32 PM
Sounds perfect! Good stuff!
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on February 21, 2006, 02:49:43 AM
Update to version 1.2 to fix a couple of minor bugs, upate the documentation and add a couple of extra features. Feature complete now I believe. See the original post for updated documentation and zip file.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Hans on February 21, 2006, 08:29:57 AM
Looks good.. but how to implement this?
To be honest, the whole snippet concept isn't clear to me. Maybe an explanation about this menu feature can also help in implementing other snippets as wll.

Thanks, Hans
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Stefan on February 21, 2006, 08:35:29 AM
@brofield:
On your test installation, I don't find any difference between the first (full tree) and the trimmed menu. I expected the trimmed tree to look like the regular menu (for example in the stock round template).
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on February 21, 2006, 08:36:24 AM
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on February 21, 2006, 08:38:32 AM
Yeah. I'm in the middle of testing a new version. The test site is off-limits for the moment as the results will not be what you expect.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on February 21, 2006, 09:28:31 AM
Updated to version 1.4. Details in the main post. Updated zip file in the main post. test site available once again. I'm spent.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: PeterM on February 21, 2006, 09:39:39 AM
This is really cool stuff, nice work  :mrgreen:
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on February 21, 2006, 10:34:38 AM
wooooooow  :-D  :-D  :-D
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: PeterM on February 21, 2006, 10:57:39 AM
Updated to version 1.4. Details in the main post. Updated zip file in the main post. test site available once again. I'm spent.

1.5?
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on February 21, 2006, 10:59:13 AM
Updated to version 1.6. Details in the main post. Updated zip file in the main post. Test site available once again. Fixes a couple of minor bugs I found in a code review.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: virgil on February 21, 2006, 11:02:42 AM
Hi everybody

yes, I know, sometimes I am really hard in understanding things  :roll: ... this IS one those miserable moments  :|

To deduce from reactions, show-menu2 must be really great... the problem is: I do not really get the difference and
the improvement in comparison to the original function, but I would like to understand because I always try to
inprove my installation, where useful.

Could somebody (in short sentences, witn no more than two syllable long words  :roll:) explain it to me?

Thank you.

Cheers
Virgil

P.S.: Eventually German explanation is welcome  :-D
        (but not a must)
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on February 22, 2006, 02:04:20 AM
In summary, if you don't know that you need it, then it doesn't matter one way or the other. On the other hand, there is no problem to use it instead of the builtin. The new one has the following advantages.

Speed
It should be faster as it hits the database only once per page load. The builtin function hits the database multiple times per function call. This is at the expense of more memory as all page information is stored locally. Realistically, the memory load isn't large.

Flexibility
It can generate menus in many different ways. Covering all of the existing menu's abilities (as far as I know) and adding a few more of it's own.

Valid XHTML
The existing menu function generates HTML that doesn't validate. Minor concern really, but many people like to have valid HTML.

Easy CSS styling
It generates a menu with lots of classes on each element to allow easy styling of the menu via CSS. This should allow the generated menus to be used in pretty much any way, e.g. popups, dropdowns, etc. See websites about CSS menus.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on February 22, 2006, 07:25:48 AM
Updated to version 2.0. See the head post for details. This is the final update that I expect to do, aside from bug fixes.

Changes in this version are:
* optionally specify what HTML tags to use when generating the menu. Default is ul/li, but any other combination is possible, such as ol/li, tr/td, etc.
* optionally specify an ID for the top level menu tag
* demo site updated showing off these features
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Stefan on February 22, 2006, 09:44:13 AM
Valid XHTML
The existing menu function generates HTML that doesn't validate. Minor concern really, but many people like to have valid HTML.

The core function show_menu should generate valid html too... Or do you have problems with it?
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on February 22, 2006, 09:49:22 AM
A friend had led me to think that it was generating invalid HTML. Something like:

<ul>
   <li>item</li>
   <li>item
       <li>
           <ul>
               <li current>item<li></li></li>
               <li>item</li>
           </ul>
       </li>
   </li>
   <li>item</li>
</ul>


It must have been a communication breakdown. I'll fix the comment in the main entry.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on February 22, 2006, 11:04:47 AM
@brofield

i like your new menu function i only had problems with hidden pages.

Had a main Page wich has visibility public and two subpages under this with visibility hidden. If i click on the public page link got the following error:

Code: [Select]
Warning: array_keys(): The first argument should be an array in .....\modules\show_menu2\include.php on line 247

And a question to the parameters. I Have two menus. One horizontal wich only plays the root level and a vertical submenu wich only should display the subnavigation.

Menustructure:
Page
  Subpage1
     Subpage 1.1
     Subpage 1.2

Function call:
<?php show_menu2(1, -1); ?>

Result:
when you on Main Page it shows in the submenu Subpage1 what is ok
when you on Subpage1 it shows in the submenu Subpage1, Subpage 1.1 and Subpage 1.2 what i dont like.

I'm looking for the parameter wich shows me on the Subpage1 in the submenu only the Subpage 1.1 and Subpage 1.2.

Could you pleas give me a hint how to get this?

Thanks

Matthias



Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on February 22, 2006, 11:41:01 AM
Had a main Page wich has visibility public and two subpages under this with visibility hidden. If i click on the public page link got the following error:

Code: [Select]
Warning: array_keys(): The first argument should be an array in .....\modules\show_menu2\include.php on line 247

I don't see this error. The page http://riseup.co.nz/pages/parent.php has 3 children, 2 are hidden and 1 is private. It works fine for me there. I'm not sure how to help you without being able to reproduce the error.

I Have two menus. One horizontal wich only plays the root level and a vertical submenu wich only should display the subnavigation.

<snip>

when you on Main Page it shows in the submenu Subpage1 what is ok
when you on Subpage1 it shows in the submenu Subpage1, Subpage 1.1 and Subpage 1.2 what i dont like.

I'm looking for the parameter wich shows me on the Subpage1 in the submenu only the Subpage 1.1 and Subpage 1.2.

Could you pleas give me a hint how to get this?

Using page http://riseup.co.nz/pages/foo.php
See the example "Root Level Only" to display only the root level.
See the example "First Level" to display only the children.
I think this is what you are after, otherwise you might want "Current Children" or "Current Kids (1 level)".

Regards,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on February 22, 2006, 12:22:26 PM
Updated to version 2.1
* remove all warnings and notices when running PHP at error_reporting = E_ALL
* no other changes at all, no need to upgrade if the warnings don't affect you
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on February 22, 2006, 02:12:54 PM
Hello,

Thanks for the fast response. Have testet "Current Children" and "Current Kids (1 level)" but got not the result i want. So my solution now is the following. Have three templates with three different parameter for the submenu:


Look here: http://www.seefest-freudenberg.de. Menu is only css based.

Thanks for the great work

Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on February 24, 2006, 06:04:03 AM
Upgraded to version 2.2
* fully compatible with version 2.1 call signature
* can specify multiple tags to be output for menu and items
* can generate breadcrumbs
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on February 25, 2006, 10:26:30 AM
Update to version 2.5

* fixes bug with generation of crumbs.
    see "Breadcrumbs" at http://riseup.co.nz/pages/foo/fig/snot.php

* added ability set max levels. i.e. max of 2 levels, but never more than the current level
    see "Max 2 Levels" for demo of new SM2_MAX feature
    http://riseup.co.nz/pages/foo.php  (only 1 level displayed as foo is current level)
    http://riseup.co.nz/pages/foo/fig/snot.php  (only 2 levels displayed, as max is 2)

* changed the function parameters to make it a bit easier to understand
    (existing pages will have to change to match it. changes are in $aStart, $aMaxLevel and $aTrimTree only)
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: rabsaul on February 28, 2006, 10:56:51 AM
Is there a way I can work with this code snippet to provide an "on state" for links I'm "hard-coding" into the template?

I have the regular full WB nav as a vertical bar on the right hand side of my pages. However, there are a handful of basic pages that I want permanent links to in a top horizontal nav bar which I have hard-coded in. The problem is that I don't know how to show an "on state" for dynamically-generated pages.

The site is here: http://www.ccpclex.org

If this snippet won't work for that, any other ideas would be most welcome.

Thanks!
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on February 28, 2006, 12:35:30 PM
Hello,

this snippet seems what you need. Looked at the link you posted above. You have a horizontal menu wich should only show the root level. This you got in your template with <?php show_menu2(1, SM2_ROOT, SM2_START); ?>. And the menu on your right side wich shows all pages you got with <?php show_menu2(); ?>.

The Layout you define in the screen.css. Your existing one should work without changes. (not shure, done only a short look on it)

Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: rabsaul on February 28, 2006, 05:47:17 PM
Hello,

this snippet seems what you need. Looked at the link you posted above. You have a horizontal menu wich should only show the root level. This you got in your template with <?php show_menu2(1, SM2_ROOT, SM2_START); ?>. And the menu on your right side wich shows all pages you got with <?php show_menu2(); ?>.

The Layout you define in the screen.css. Your existing one should work without changes. (not shure, done only a short look on it)

Matthias
Thanks, Matthias... the thing is that this is hard-coded, and I want *only* those particular links you see there, not every page that gets created at the root level. Make sense? Will this still work somehow?
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on February 28, 2006, 06:07:57 PM
Hello,

There is a ability to only show menus using the page_id, but I'm not shure if it's possible to define more then one page_id. Please ask brofield.

Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 01, 2006, 03:33:51 AM
Is there a way I can work with this code snippet to provide an "on state" for links I'm "hard-coding" into the template?

If I understand you correctly:

As ruebenwurzel suggested, use a fixed parent for the menu.

This menu won't show normally because of the invisible parent. However, you can show it in your template where-ever you want by specifying the ID of the invisible parent:
<?php show_menu2(1, **INVISIBLE_PAGE_ID**, SM2_ALL, SM2_ALL); ?>

Style it using CSS:
.menu-current { font-weight: bold; }

The menu "Hidden Menu" at the demo site (see main post for URL) uses this technique.

Cheers,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: rabsaul on March 01, 2006, 04:10:02 AM
Thanks, Brodie.

Oops, I should have come back to this thread and mentioned that I had got another solution:

http://forum.WebsiteBaker.org/index.php/topic,2652.0.html

As you'll see from the above, the only problem I'm having is the home page. I haven't figured out the PageName call for it, since it's being "redirected." I've tried, welcome, index, default, home, default_page, default_link etc. No luck yet.

tim
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: kweitzel on March 01, 2006, 08:14:24 AM
when you mean homepage, do you actually mean the intro page? Then you would find it is named "intro.php".

Otherwise the first page in your structure of created pages (normally the hompage) has pageid 0. But I think you mean the intropage. This is a static page and not in the DB.

cheers

Klaus
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: rabsaul on March 01, 2006, 08:21:42 AM
No, it is not a static page. My home page is simply the top page in the site structure. It is dynamic like all the rest.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 01, 2006, 08:23:30 AM
Keep this discussion on topic. Move yours to
http://forum.WebsiteBaker.org/index.php/topic,2652.0.html

Regards,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: kweitzel on March 01, 2006, 09:16:48 AM
sorry for that, replied to the other post ...

cheers

Klaus
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Stu-Art on March 01, 2006, 10:05:39 AM
Hi, the css menu do not work on your example page in IE 6 (http://riseup.co.nz/pages/index.php).  However you say on this page you lifted the code from the pure css menus example, which DOES work on my IE 6 and IE 7 browser. I think they apply a little js script for compliance.

Have a look here http://dean.edwards.name/IE7/compatibility/Pure%20CSS%20Menus.html. 

Can this be added to your improved menu code?

Stu...


Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 01, 2006, 10:26:19 AM
It's a demo page for the menu generation function, not for the menu itself. The HTML is correct, it is just browser's (IE6 in particular, but also FF 1.0x and others) which can't handle it. Sure there are work arounds to make it look better in different browsers, but it doesn't really matter for a demo. In any case, I did install IE7 for the hell of it.

Cheers,
Brodie

BTW, calling Dean Edwards IE7 a "little js script" is understating it just a little, no? :-)
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 03, 2006, 03:46:13 AM
Updated to version 2.6

* bug fix for 2.5, drop in replacement
* fixed bug where multiple page menus were not working correctly. Now defaults the menu to 0 which will use the default menu for that page (as far as I can see). Passing 1 for $aMenu will continue to get the main menu.
* added more items to the template so that now you can customize the generated item more
* a little faster
* doesn't output the menu-N and menu-child-N classes by default. Optionally turn it on.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on March 03, 2006, 11:44:36 PM
Hello,

tried your latest version (2.6) on different installations and got always the following error:

Code: [Select]
Warning: array_keys() [function.array-keys]: The first argument should be an array in C:\Intranet\Apache2\htdocs\modules\show_menu2\include.php on line 123

Warning: Invalid argument supplied for foreach() in C:\Intranet\Apache2\htdocs\modules\show_menu2\include.php on line 123

Until 2.5 all works very fine. You change the $aMenu, so i tried it with '0' and '1' and also tried without any arguments, always the same result. Whats going wrong?

Thanks for this great code snippet and for your help

Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 06, 2006, 01:36:30 AM
Must've screwed something up. It works fine on my test installation, so if you can figure out what the menu structure is that causes the error then I would appreciate it. I won't get to it for a few days at least though as I am not where my computer is. In meantime I will downgrade the release.

Cheers,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on March 06, 2006, 06:24:34 AM
Hello,

So here a short description, hope its enough:

Have a page with only rootpages (now subpages) = Error on every page
Have a page with rootpages and subpages = Error only on pages without subpages

Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 07, 2006, 01:13:49 PM
I don't see how this is different from http://riseup.co.nz/pages/flidget.php
It has no subpages, yet there is no error from it.

I changed the way show_menu2 determines the parent items of the current page from doing it manually to using the page_trail data that WB stores. This appears to be what is causing the problem. It appears that the page_trail data stored for your pages is not correct.

How old is your WB installation? How many times has it been updated? Do you understand the WB database enough to check the page_trail data and see if it is stored correctly? If there is a chance that some WB databases don't correctly store this info then I will change back to the old way.

Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on March 07, 2006, 02:56:52 PM
Hello,

this is a new clean WB 2.6.2 installation and your script works perfectly till version 2.5.

Quote
I don't see how this is different from http://riseup.co.nz/pages/flidget.php
It has no subpages, yet there is no error from it.

The different is your complete Site structure has subpages. My problems are only with homepages wich have in the complete site structure no subpages. Hope this is more understandable.

Try a new clean WB installation and make only a few pages with no subpages and then try your show_menu2.

Looked at the page_trail database. So it seems that subpages have two entries (the root and the subpage) and root pages only have one entry. Could it be that your script needs a second entry on one page otherwise it produces an error? Thanks for your help. 

Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 09, 2006, 08:09:50 AM
Ok. I found the problem you were running into. It was only NOTIFY errors that were being produced, so the original version should have still worked, just noisily. I put up a new version of 2.6 which should solve the problem.

Cheers,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on March 09, 2006, 08:42:46 AM
Hello,

Thank you for this fantastic snippet. Version 2.6 works like a charm, i love it.

Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Tim on March 10, 2006, 07:58:18 AM
Hi Brofield,

I've implemented this snipped like you suggested in the other thread and it's working like a charm - however I have run into one small issue.

If you look at http://timtekindustries.com/wb you can see that the children (under Home) are formatted (using divs) so that they have a white left border, are indented and are in normal weighted text.

However if you click on one of those children the code that this snipped generates means that they are no longer classed as children for some reason and so they lose this formatting. However ideally I'd like for them to always maintain this bordered/indented formatting regardless of whether they are the current page or not - they're still children of the parent, but for some reason the code that show_menu2 outputs doesn't give them a child class.

Is there any way to get around this? I'm calling show_menu2() with no parameters, btw.

Thanks,
Tim
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 10, 2006, 08:12:48 AM
What you are wanting to do is format the menu depending on if it has children or not (independent of what the current page is). The menu-child class indicates that the item is a child of the current page. You want to use the menu-expand class instead, which indicates that it has children. The trouble is, by using divs for both menus and menu items, it is hard to style it correctly. Add a custom class to either a menu or an item so that you can determine which one it is, or better go back to using UL/LI.

Something like...

div.menu-top { /* top level formatting */ }
div.menu-expand > div.item { /* indent formatting */ }

Menu's really fit the UL/LI structure best.

ul.menu-top { /* top level formatting */ }
ul.menu-top ul { /* sub level formatting */ }
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: PeterM on March 10, 2006, 08:38:59 AM
Would it be possible to incorporate this script into the standard WB zip-file. I didn't use this snippet to make the menus of my templates, because of the fact that it's not standard WB yet.

Some of my templates, for instance, K2 would have looked better with this template.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Stefan on March 10, 2006, 09:25:57 AM
@PeterM
Definitely. I guess it could be a drop-in replacement for the current core menu (frontend::menu())

@brofield
Can you modify the wrapper functions page_menu() and show_menu() to utilize your script but keep the current order of parameters (for backwards compatibility) ?
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on March 11, 2006, 09:40:58 AM
Thanks! Decided to try this on my site and it works fantastic!

A minor CSS question ... I used this

.menu-child{
   background-color: #F3F3F3;
   border : 1px solid #EEEEEE;
}

.menu-current{
   background-color: #DDDDDD;
   border : 1px solid #16B144;
}
 

.menu-expand{
                font-weight: bold;
}


and you can see if you go here http://stormvisions.com/pages/art-design/3dgamestudio.php that the second level pages with no subpages are bold instead of only the pages with subs. Any hints?

Three thumbs up!
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 11, 2006, 09:53:10 AM
font-weight is inherited by the child menus. Try
.menu-expand > a { font-weight: bold; }

This will only modify the <a> links directly underneath a .menu-expand classed tag and no children.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 11, 2006, 10:19:39 AM
@brofield
Can you modify the wrapper functions page_menu() and
show_menu() to utilize your script but keep the current order
of parameters (for backwards compatibility) ?

It is actually quite difficult due to the item formatting that show_menu uses. There are a few problems:


Have done a first kick at changing sm2 such that a merge of show_menu and show_menu2 will be possible. It is running at the demo site now (see the README file there). Will continue to play a little to see what I can do.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on March 11, 2006, 06:22:52 PM
font-weight is inherited by the child menus. Try
.menu-expand > a { font-weight: bold; }
This will only modify the <a> links directly underneath a .menu-expand classed tag and no children.

For some reason I couldn't get that to work -not sure if there was a typo? Don't know enough about css but I did get this to sort of work like this though when I get down 3 levels deep I note that bold is back ...

Code: [Select]
.menu-child{
background-color: #F3F3F3;
border : 1px solid #EEEEEE;
                font-weight: normal;
}

.menu-current{
background-color: #DDDDDD;
border : 1px solid #16B144;
}


.menu-expand {
               font-weight: bold;
}


Thanks again for this excellent mod.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Tim on March 13, 2006, 06:42:44 AM
I managed to get it working Brofield, thanks again.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: phil on March 28, 2006, 02:33:00 PM
your menu function looks quite impressive: I'm trying to have a menu like this, where all the

home | study | about
is there a way to get this?
I only get it to look like home | study | about |

obviously, the red vertical bar at the end is ugly. Does anybody have a solution for this?

Thanks a lot
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: baelinc on March 29, 2006, 07:00:36 PM
I am using this menu function, and i really like it. The only problem that i am having, is how to tell this code to be a horizontal menu instead of a vertical one. Here is the code that i am using, please edit it so that it shows as a horizontal menu....

Code: [Select]
<?php show_menu2(0SM2_ROOT+1SM2_START?>
Thanks,
Johnathan
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on March 29, 2006, 09:12:36 PM
Hello,

how a menu is shown (horizontal, vertical) is css based. Look here.

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

Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on April 03, 2006, 01:09:48 AM
Want to use this for a sitemap and having a little problem getting it to show [page_title] instead of [menu_title]

Here is what I tried

show_menu2(0, SM2_CURR+1, SM2_CURR+1,'[a][page_title][/a]');

but it shows the [menu_title]

http://stormvisions.com/pages/art-design.php
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on April 03, 2006, 02:02:20 AM
Documentation is at:
http://forum.WebsiteBaker.org/index.php/topic,2584.0.html

Use [page] instead.

Cheers,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on April 03, 2006, 02:29:35 AM
Thanks. Looks like I was looking at an older doc. I did change it to [page] but it still shows the menu title.  :?

I did have a suggestion for the future as well. Maybe you can add a feature to optional show the meta description/keywords as well. This can be useful in the sitemap for example where I can show the title and short description of each page. For example


Sitemap

Graphics
- Photoshop
  - Plugins - Add features to your program with these free plugins. [keywords: art, design]

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on April 11, 2006, 09:12:18 PM
@brofield

I spotted this error in my scripts.log file. Not sure if it is important.

PHP Warning:  array_keys(): The first argument should be an array in /modules/show_menu2/include.php on line 124
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 01, 2006, 07:30:35 AM
I have released a beta of v3.0 at http://code.jellycan.com/show_menu2/

This version has a call signature similar to the existing show_menu, however it is not a fully drop in replacement for it due to the problems I mentioned in my previous email. Let me know what problems you have with it.

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 01, 2006, 07:38:07 AM
Sorry, no easy solution that I can think of.

B

your menu function looks quite impressive: I'm trying to have a menu like this, where all the

home | study | about
is there a way to get this?
I only get it to look like home | study | about |

obviously, the red vertical bar at the end is ugly. Does anybody have a solution for this?

Thanks a lot
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 01, 2006, 07:39:33 AM
You are probably better to do this with the sitemap module. I will look to see what might be involved.

B


Thanks. Looks like I was looking at an older doc. I did change it to [page] but it still shows the menu title.  :?

I did have a suggestion for the future as well. Maybe you can add a feature to optional show the meta description/keywords as well. This can be useful in the sitemap for example where I can show the title and short description of each page. For example


Sitemap

Graphics
- Photoshop
  - Plugins - Add features to your program with these free plugins. [keywords: art, design]
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 01, 2006, 07:44:06 AM
I've released version 2.6.1 which should clear this problem up. See http://code.jellycan.com/show_menu2/

B

@brofield

I spotted this error in my scripts.log file. Not sure if it is important.

PHP Warning:  array_keys(): The first argument should be an array in /modules/show_menu2/include.php on line 124

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 02, 2006, 05:09:17 AM
your menu function looks quite impressive: I'm trying to have a menu like this, where all the

home | study | about
is there a way to get this?
I only get it to look like home | study | about |

obviously, the red vertical bar at the end is ugly. Does anybody have a solution for this?

I take it back. Of course there is a way to do this. See the demo site at http://code.jellycan.com/sm2test/ and have a look at the "Root Only (TEXT)" sample. Essentially you set the normal item to " | link" and set the first item to "link".

Cheers,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: kickarse on May 03, 2006, 05:09:26 PM
Just curious if you thought about adding functionality such as this
(from your site :))

Code: [Select]
<div class="menu">

<ul class='menu-top'>
<li class='menu-sibling'><a href='http://code.jellycan.com' target='_top'>Home</a></li>
<li class='menu-sibling'><a href='http://code.jellycan.com/simpleopt/' target='_top'>SimpleOpt</a></li>
<li class='menu-sibling'><a href='http://code.jellycan.com/simpleini/' target='_top'>SimpleIni</a></li>
<li class='menu-sibling'><a href='http://code.jellycan.com/moji/' target='_top'>Moji</a></li>
<li class='menu-sibling'><a href='http://code.jellycan.com/langselect/' target='_top'>LangSelect</a></li>
<li class='menu-expand menu-current'><a href='http://code.jellycan.com/show_menu2/' target='_top'>show_menu2</a>
        <ul><li class='menu-child'><a href='http://code.jellycan.com/sm2test/' target='_top'>Test</a></li></ul>
</li>
<li class='menu-sibling'><a href='http://code.jellycan.com/macros/' target='_top'>Macros</a></li>
<li class='menu-sibling'><a href='http://code.jellycan.com/comments/' target='_top'>Comments</a></li>
</ul>
</div>

Thought about giving the a href a class of what the name of the link is like so

Code: [Select]
<li class='menu-sibling'><a href='http://code.jellycan.com/comments/' class='comments'>Comments</a></li>
Something that would be populated by $page_id or $title ?

This would help if you wanted to style the link with pictures as navigation instead of text. Giving complete control over the menu look.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on May 04, 2006, 02:50:39 AM
@brofield - no feedback on the beta until this weekend but I wanted to say the sitemap feature with the added description field is cool -just what I wanted. :) Also thanks for picking up that arraykeys bug and for all your other work.  8-)

If you're still taking requests for future updates here's one I had a while back on my previous layout, but others have requested it. How about the ability to assign small 16x16 icons to the menu items. I did a messy hack on my old one where I simply did something like [page_name].jpg and save images named after each page but made for many duplicated images. I also did similar with page level ie [level].jpg (forget what the actually variables were called).

In my case all I originally wanted to have a different top level icon and color for each top level category

Graphics (paint_brush.gif)
News (newspaper.gif)

Then you could use a similar logo/color scheme on the page; this helps on a site with many types of content for the visitor to readily know what section they are in. In other words all art related pages are blue scheme, with paint brush logo (matching the menu icon) etc.

Anyway sorry for inflicting you with my rambling thought process. :) This should be part of the WB core as it is absolutely excellent.

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 04, 2006, 03:05:42 AM
@kickarse
You can already do something like this by using the [menu_title] as the class in the item format. You would want to keep all of your menu titles as single words I guess. In the next beta I will include a few extra items like page_id, parent_page_id, description, keywords. e.g.
Code: [Select]
"<a href='[url]' target='[target]' class='[menu_title]'>[menu_title]</a>"

@bupaje
I have no idea what you are wanting.

Regards,
B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 04, 2006, 04:48:20 AM
Release of show_menu2, version 3.0 beta 2.

Changes in this version are:

Details, demo and downloads at http://code.jellycan.com/show_menu2/

Regards,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 04, 2006, 05:08:25 AM
In my case all I originally wanted to have a different top level icon and color for each top level category

Graphics (paint_brush.gif)
News (newspaper.gif)

If you use the new 3.0 version then you could use the [level] or [page_id] formats set the class or link id. To do class based images though, you should be able to do it with the current version and CSS selectors. See http://css.maxdesign.com.au/listutorial/master.htm

Cheers,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: virgil on May 04, 2006, 02:09:33 PM
@brofield

Hi Brodie
I would like to use your show_menu2 snippet to create a Sitemap with
description + keywords like shown in your demo page.  :roll:

I guess that -to create a normal menu- you put a regular php-call of show_menu2
in the index(.)php file, which will create the menu call on every page of your site
... but...
I want a sitemap to be shown only on a single page   :|

- How can I do that?
- Wich release of the snippet do I at least nee?
 :?

Thx for answers...
Regards,
Virgil
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 04, 2006, 02:59:31 PM
I guess that -to create a normal menu- you put a regular php-call of show_menu2
in the index(.)php file, which will create the menu call on every page of your site
... but...
I want a sitemap to be shown only on a single page   :|

- How can I do that?

Instead of wysiwyg, choose Code for the page type. Then write the call to show_menu2 directly into the page. I have created a demo of this at http://code.jellycan.com/sm2test/pages/site-map.php

- Wich release of the snippet do I at least nee?

v3.0 to get keywords and descriptions. Ensure that you pass SM2_DESCKEY in the flags. For example the code I used in the sample page is...

Code: [Select]
show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_DESCKEY,
   '<span class="stuff">[a][page_title][/a] (menu: [a][menu_title][/a])'.
   '<br /><i>[description]</i><br />([keywords])</span>',
   "<ul class='sitemap'>",'</ul>','<li>','</li>',false,false);

Cheers,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 04, 2006, 03:07:07 PM
Release of show_menu2, version 3.0 beta 3.

Changes:

Details, demo and downloads at http://code.jellycan.com/show_menu2/

Currently these functions are named sm2_show_menu and sm2_page_menu so that I can test them side by side. See the bottom of the test page for some demos. Basically, it isn't working. I don't quite understand the results that I am getting out of show_menu. It seems like it is not rendering the menus like it's call signature says it should. If someone can have a look and give me comments on if the results I see there are what you expect. Perhaps a few more examples to work with.

However, there is never going to be 100% backward compatibility with those functions without keeping the existing code. I don't see why we don't just do that. Just add show_menu2 to the main distrib and encourage template writers to use it. If you want to get rid of the original functions in the future then do so.

In any case, this is the last release / bugfix for a few weeks. Enjoy.

Regards,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: virgil on May 04, 2006, 04:27:08 PM
@brofield


Hi again

Instead of wysiwyg, choose Code for the page type.
Then write the call to show_menu2 directly into the page.

It's exactly what I did before posting my question (nice t see that I was on te right way)
but it doesn't work...  :|

I get:

Code: [Select]
Parse error: parse error, unexpected T_STRING
in /home/httpd/vhosts/mydomain.com/httpdocs/modules/code/view.php(30) : eval()'d
code on line 5

My entry in in the Code page was

Code: [Select]
<?php
 show_menu2
(0SM2_ROOTSM2_ALLSM2_ALL|SM2_DESCKEY
   &#39;<span class="stuff">[a][page_title][/a] (menu: [a][menu_title][/a])&#39;.
   &#39;<br /><i>[description]</i><br />([keywords])</span>&#39;,
   "<ul class=&#39;sitemap&#39;>",&#39;</ul>&#39;,&#39;<li>&#39;,&#39;</li>&#39;,false,false);
?>

(BTW: After saving the page the   "<?php"   and the   "?>"   disappears; is this OK?)

What do I do wrong? :?

Thx for your reply
Regards,
Virgil
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 04, 2006, 05:19:55 PM
Just put the call to show_menu2. You can't use <?php ?> in a code page.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: virgil on May 05, 2006, 12:00:12 AM
Hi Brodie

Thx for reply.

I've put ONLY this in a code page:

Code: [Select]
show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_DESCKEY,
   '<span class="stuff">[a][page_title][/a] (menu: [a][menu_title][/a])'.
   '<br /><i>[description]</i><br />([keywords])</span>',
   "<ul class='sitemap'>",'</ul>','<li>','</li>',false,false);

... we're on the good run  :-D .... BUT  :x ...

I get the following now (EXACTLY what you see... Codes, but no content):
(BTW: the links [page_title] and [menu_title] are working correctly)

Code: [Select]
<
class='menu-top
'>< class='
menu-sibling'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
menu-sibling'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
menu-expand menu-sibling'>[page_title] (menu: [menu_title])
[description]
([keywords])<
class='
'>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
menu-expand'>[page_title] (menu: [menu_title])
[description]
([keywords])<
class='
'>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>>>>>< class='
menu-expand menu-sibling'>[page_title] (menu: [menu_title])
[description]
([keywords])<
class='
'>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>>>< class='
menu-sibling'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
menu-expand menu-sibling'>[page_title] (menu: [menu_title])
[description]
([keywords])<
class='
'>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>>>< class='
menu-expand menu-sibling'>[page_title] (menu: [menu_title])
[description]
([keywords])<
class='
'>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
menu-expand'>[page_title] (menu: [menu_title])
[description]
([keywords])<
class='
'>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>>>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>>>< class='
menu-expand menu-sibling'>[page_title] (menu: [menu_title])
[description]
([keywords])<
class='
'>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>>>< class='
menu-sibling'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
menu-expand menu-sibling'>[page_title] (menu: [menu_title])
[description]
([keywords])<
class='
'>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>>>< class='
menu-expand menu-sibling'>[page_title] (menu: [menu_title])
[description]
([keywords])<
class='
'>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>< class='
'>[page_title] (menu: [menu_title])
[description]
([keywords])>>>< class='
menu-current'>[page_title] (menu: [menu_title])
[description]
([keywords])>>


There must still be sme tiny mistake, but as I'm definitly not a coder... aehm... sorry... could you help once more?  :roll:
Sorry if I'm abusing you being so pacient.

Regards,
Virgil
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 05, 2006, 12:51:55 AM
Dunno, there is obviously something going wrong that is losing your ul tags. Try a copy and paste of this. Note that in my stuff the call to show_menu2 is all on one line.

Code: [Select]
show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_DESCKEY, '<span class="stuff">[a][page_title][/a] (menu: [a][menu_title][/a])<br /><i>[description]</i><br />([keywords])</span>',"<ul class='sitemap'>",'</ul>','<li>','</li>',false,false);

This is the exact code that I am using on my test page. Note that I don't recommend putting the CSS into the code page like I am doing. I have only done it because I'm lazy and I wanted to work around the template style sheet. It should actually go in the template's style sheet.

Code: [Select]
echo <<<FOO
<style type="text/css">
div.left ul, div.left li, div.left span, div.left * {
    text-align: left !important;
}
ul.sitemap li {
    text-align: left;
    padding-top: 0.5em;
}
ul.sitemap .menu-current > span.stuff {
    display: block;
    background-color: #E0E0FF;
    border-right: 2px solid blue;
}
div.left { text-align: left !important; }
</style>
<h1>Sitemap</h1>
<div class="left">
FOO;

show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_DESCKEY, '<span class="stuff">[a][page_title][/a] (menu: [a][menu_title][/a])<br /><i>[description]</i><br />([keywords])</span>',"<ul class='sitemap'>",'</ul>','<li>','</li>',false,false);

echo "</div>";

Ensure that you are using either 3.0b2 or 3.0b3 as the first release didn't have support for the description/keywords stuff. Note that if you are using show_menu2 multiple times on the page then you need to have the SM2_DESCKEY flag passed to it the very first time you call it otherwise you will get "0" for your description and keywords.

Good luck.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: virgil on May 05, 2006, 08:04:58 AM
Well, Brodie, you know... there are times I really do not understand computers... this is one of those...  :? :? :?

Don't ask me why... it's hard to believe... I did exactly the same like before... but IT WORKS NOW!!!  :-D :-D :-D


Quote
Note that in my stuff the call to show_menu2 is all on one line.
... just only because I  this?  :?

Well, man ... thats really a great application (sitemap) to use your show_menu2 ...
exactly what I was looking for!

THX so much and Regards,
a very greateful Virgil
 :lol:
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: virgil on May 06, 2006, 07:57:21 AM
Hi Brodie
I'm here again... :roll:... with a new wish about the sitemap functionality of show_menu2...

As mentionned above, the stuff works great, except for this:

If I have a site with multiple menu, let's say:
1.) a regular multiple nested main menu on the left with almost all pages of the site, and
2.) a 'only first level' top menu (with the half dozen 'one-click-quick-access-important-pages')
3.) a menu for multilanguage switching
4.) and so on...

then I have the problem, that (logically) the sitemap shows only the pages included in the same
menu block. So this means:

When I place the sitemap (wich is an important page to me) on the top menu '2.)',
only the half dozen entries of this menu are displayed in the sitemap...
well, its' not really what a sitemap is meant to be... isn't it?

Now, how can I alter the entry of the code page the way that
no matter how many menu blocks I use in my template and
no matter in wich menu I place my sitemap link,
ALL PAGES are captured and followingly SHOWN in the sitemap?  :wink:
(like the regular sitemap function does...)

Thx for your reply
Regards,
Virgil
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: succhi on May 06, 2006, 05:38:44 PM
Hey Virgil

It sounded like Brodie will be away from this for a short while so I'll send you an updated version (find attached) that I have modified to help you out. Just update the current one and add the new flag (as shown below) and it should work for you. I have updated the version to reflect a small change so that you can track which version you have so you can roll back if you need. Brodies latest is 3.0b3 so I have changed this to (3.0b4). I'm sure brodie will re-code this and bring out a proper 3.0b4 with a more elegant solution to the problem you are facing. Until then use this and see if it gives you your desired result.

I have tried it and it works on my small example.

You need to add an extra flag called SM2_MULTIMENU to your function call. For the snippet which adds the flag see below.

Code: [Select]
show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_DESCKEY|SM2_MULTIMENU, ...
@brodie.
Can you have a look and see if this is OK and either keep this as 3.0b4 or rework it and re-release it. I haven't worked much with bitwise operators so I might have it wrong. It seems to work well but I'll let you be the judge.

I like how far your mods on it have come since you first released it. Well worth using I can see.

Cheers
Stuart

[gelöscht durch Administrator]
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: virgil on May 07, 2006, 12:45:19 AM
@stuart

You guys are fantastic and I'm getting really gelous about your coding ability...
It works great  :-D :-D :-D

At the beginning of this topic I was wondering if I really will ever nedd this modul, but the longer
I think it's a great stuff. Im still plaing around with the standard show-menu for the navigation
itself as I am working on implementing udm4, wich seem to work properly with it.

This input was given to me by melissa in this topic:
http://forum.WebsiteBaker.org/index.php/topic,2805.msg18740.html#msg18740


@brodie @stuart @all-php-pro's

Maybe, if you guy are willing to help out implementig UDM4 in show_menu2, this would,
I thing, boost template creation at new dimensions...

Cheers
Virgil

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: succhi on May 07, 2006, 03:11:24 AM
Hmmm...

I can certainly see from some other posts interest in being able to add css to the first and last element in a submenu/menu and also to the element just before a submenu (collapsed or otherwise) (update: already there as "class='menu-expand'"

<ul>
    <li class="first-li"></li>
    <li class="menu-expand">
    <ul>
        <li class="first-li"></li>
        <li></li>
        <li class="last-li"></li>
    </ul>
    </li>
    <li class="last-li"></li>
</ul>

I'm not sure I have the time and it really is Brodie's code so I don't want to stomp all over it. But I will have a look and see what I can find.

Personally I am looking for a way to do UDM4 style menus without having to pay. Nearly all the nice dhtml solutions are asking for money now. Understandable I guess because they need to stay on top of browser compatibility issues etc. If I code my own one up from scratch I can't actually test it on all browsers so I may just need to invest one day.

Stuart
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: succhi on May 07, 2006, 05:21:57 AM
@virgil

You can already add what Melissa wanted using show_menu2. Near the end of the function call is the $aTopMenuOpen varibale and you can pass it '<ul id="udm" class="sitemap udm">' which gives the following only at the top <ul id="udm" class="sitemap udm menu-top">. You don't need the sitemap in there, I just wanted to illustrate the possibilities.

I'm still looking into the start and finish parts so that people can eventually do things like

Home | About | Contact Us

Or other really exciting layouts that need specific handling for start or end elements like borders or colours, images etc.

Stuart
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: succhi on May 07, 2006, 02:34:06 PM
OK a quick update on show_menu2 to allow you to track the first and last siblings in a menu/submenu. All first items will have "class='first'" added to the item tags if available, vice versa last items. You will need to add the new flag SM2_FIRSTLAST as shown below.

If you would like to do something like

  Home | About | Contact Us

Try the following with the updated version

Code: [Select]
echo "<style> .rootnav span {border-left: solid 1px red; padding: 0 10px;} .rootnav span.first {border-left: none;} </style>";

show_menu2(0, SM2_ROOT, SM2_START, SM2_TRIM|SM2_DESCKEY|SM2_MULTIMENU|SM2_FIRSTLAST, '[a][menu_title][/a]',"<div class='rootnav'>",'</div>','<span>','</span>','',false);

The updated version I have moved on to 3.0b5. Brodie may modify this if he has a better way to acheive the same thing so please be aware of this when you use this updated version. For instance I have not wanted to change things too much but it might be nice to add some arguments so the naming for 'first' and 'last' can be manually changed. I'm trying to be light handed so Brodie can come back and do what he needs in checking the additions and if the additions are worth keeping.

Stuart

[gelöscht durch Administrator]
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 08, 2006, 08:00:39 AM
@succhi
Thanks for the updates while I'm travelling. See my comments below though.

re: SM2_MULTIMENU
I don't see the use for this option. As far as I am concerned you just make multiple calls to show_menu2, once for each menu number that you want to display. It isn't like the number of submenus that are used in a site changes regularly. Feel free to enlighten me as to why this would be a good feature to have.

@virgil
why not just use multiple calls to show_menu2 as above?

@succhi
You can't stomp all over the $wb->extra_where_sql member variable as I don't own it. You always want to use this SQL unchanged (to remove hidden, private, etc pages). Additionally, the results of the database query are cached using the menu number as one of the keys, so you can't do the query this way. The query is done only once on the first call to show_menu2 for that menu. You're current update will cause problems for subsequent menu displays if it was the first call. If it wasn't the first call then your changes won't help. Loading all of the menus into the in-memory cache at one time will require a larger rewrite than that. I can't do this at the moment (travelling), nor as mentioned above can I see a good requirement for it.

re: SM2_FIRSTLAST
@succhi
If you want to get rid of the SM2_FIRSTLAST flag so that all menus generate the classes for the first and last sibling of every list, then I'll make it a standard feature. However, please rename the class names to "menu-first" and "menu-last" to maintain consistency with all other class names. No arguments are required to change the class names - CSS selectors can be used to identify items in specific menus.

Regards,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: virgil on May 08, 2006, 08:33:38 AM
Hi Brodie, welcome back


... SM2_MULTIMENU: I don't see the use for this option.
As far as I am concerned you just make multiple calls to show_menu2,
once for each menu number that you want to display...

@virgil
why not just use multiple calls to show_menu2 as above?

Quote
Feel free to enlighten me...

... well, I give it a try: :roll:

I do NOT want to call for multiple menus... I WANT the sitemap to show ALL PAGES,
no matter which menu they are assigned to, but this did NOT WORK, until succhi's
SM2_MULTIMENU option. Let me try to explain again:

Lets say I have 2 menu blocks both independent from each other (menu1, menu2):
1.) one vertical menu on the left
2.) one horizontal top menu

When I place the sitemap menu link on the top menu, the sitemap shows only the
entries of the top menu, but not of the left menu. :-(

When I place the sitemap menu link on the left menu, the sitemap shows only the
entries of the left menu, but not of the top menu.  :-(

But I want, no matter where I place the menu link... tha the sitemap shows me ALL
PAGES of my site, no matter if they are assigned to the left or to the top menu...
and that's exactly what the SM2_MULTIMENU option made possible.  :-D :-D :-D

I hope I was able, despite my linkish english, to express what I mean!  :wink:

Cheers,
Virgil
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 08, 2006, 08:40:43 AM
Yes, so on your code page that you created for the sitemap, you enter...

show_menu2(1, ....);
show_menu2(2, ....);
show_menu2(3, ....);

Or does this end up with different results from what succhi's code displays?
Perhaps I still don't understand multiple menus correctly.

Why are you not using the sitemap module? show_menu2 is designed to
(wait for it) show menus. It is flexible enough to be able to abuse it and create
sitemaps, but it isn't the main purpose of the function.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: virgil on May 08, 2006, 08:48:19 AM
Well, to be honest...

I enter in my index(.)php ...

show_menu(1, ....);
show_menu(2, ....);
show_menu(3, ....);

... NOT your show_menu2  :oops:


Reason... I want to combine it with melissa's UDM4 capabilities, see...
http://forum.WebsiteBaker.org/index.php/topic,2805.msg18740.html#msg18740

Quote
Why are you not using the sitemap module? show_menu2 is designed to
(wait for it) show menus. It is flexible enough to be able to abuse it and create
sitemaps, but it isn't the main purpose of the function.

I know... but I am fund of the additional possibilities of the sitemap with
description and keywords, what the original sitemap doesn't offer...

Cheers,
Virgil


Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: succhi on May 08, 2006, 09:02:36 AM
@Brodie

You're quite right about the whole sitemap thing. I guess with the example found at your demo site people are going to want to shoehorn show_menu2 into doing sitemaps too as shown.

I'm not actually stomping on $extra_where_sql, it is left as is in the original state or added to with the 'AND menu = $aMenu' part if required. So by default we get the 'AND menu = $aMenu' added however to select 'all menus' from a multimenu heirarchy I needed to remove the specific call the menu = $aMenu.

What if with MULTIMENU we cached the menu with a menu number like -1 so that if a secondary call is made to show_menu2 it can't find the cached menu to match and will make the second call? This can be done internally so the parameter doesn't need to be passed this way. Or instead of including the $aMenu number desired which I left as 0 we could just pass the MULTIMENU constant there as -1.

e.g. show_menu2(SM2_MULTIMENU...

I think that looks better to me and fixes up the problem of mucking up the cached menu. Alternatively we just get people, as you suggested, to drop the usage of show_menu2 for sitemaps.

I'll fix the menu-first, menu-last bit.

Stuart.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on May 08, 2006, 09:10:11 AM
@virgil

Quote
I know... but I am fund of the additional possibilities of the sitemap with
description and keywords, what the original sitemap doesn't offer...

Sitemap v.2.8 supports the following informations wich you easily can use at the place you want.

Quote
[PAGE_ID] - The page id of the specific page in the sitemap.
[PARENT] - The parent of the page that is currently in the loop.
[LINK] - The link to the specific page within the sitemap.
[PAGE_TITLE] - The title of the page within the sitemap.
[MENU_TITLE] - The title of the page as it is shown witin the menu.
[DESCRIPTION] - The description of the page within the sitemap.
[KEYWORDS] - The keywords that are given for the current page within the sitemap.
[TARGET] - The target to which the page should be opened.
[MODIFIED_WHEN] - The date when the page has been last modified.
[MODIFIED_BY] - The person who made the last modification to the specific page.

Look at the help of the sitemapmodul for more informations. We had a little problem with modified_when but there exists a fix wich is included in the next version.

@brofield
I like your show_menu2 because it is fast (only on database request) and flexible for all things that are needed. Keep it in this way and don't overload it with too much wich slows it down.

Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 08, 2006, 09:19:15 AM
I'm not actually stomping on $extra_where_sql, it is left as is in the original state or added to with the 'AND menu = $aMenu' part if required. So by default we get the 'AND menu = $aMenu' added however to select 'all menus' from a multimenu heirarchy I needed to remove the specific call the menu = $aMenu.

You can't modify it as it doesn't belong to sm2 and will be used by other functions in the template. Change your code so that the "AND menu = $aMenu" is a local variable. As you mentioned, get rid of the multimenu flag and have callers set $aMenu to SM2_ALLMENU instead. Define SM2_ALLMENU as -1. When $aMenu == SM2_ALLMENU then set the menu sql to empty so that all menus are returned. Ensure that the sorting is correct for this situation. Caching can stay as it is using -1. Alternatively we could just not cache the results of that call.

... NOT your show_menu2  :oops:

Reason... I want to combine it with melissa's UDM4 capabilities, see...
http://forum.WebsiteBaker.org/index.php/topic,2805.msg18740.html#msg18740

If you do want to use it then do the same as above replacing show_menu with
with show_menu2. To use sm2 with UDM see succhi's comment above.
http://forum.WebsiteBaker.org/index.php/topic,2584.msg20067.html#msg20067

@ruebenwurzel
Neither of these changes are going to change the performance characteristics of sm2.

Regards,
B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 08, 2006, 09:27:56 AM
To use sm2 with UDM you need to read this page, http://www.udm4.com/manual/setup/list/

At the moment sm2 always adds the "menu-top" class to the top level menu item. According to the page above, this causes problems. sm2 needs to be changed so that if a top level open is supplied using $aTopMenuOpen parameter, then we just use that string verbatim and don't add the menu-top class. Seems a reasonable assumption that if the user specifies the top level open tag then they can add whatever classes they need without sm2 meddling in it.

With that change, UDM can be used by calling sm2 with

$aTopMenuOption = "<ul id='udm' class='udm'>"
$aItemClose = "</li>\n"

Cheers,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: virgil on May 08, 2006, 12:28:36 PM
OK guys I'm back... I can't leave you alone for a couple of hours, can I?...  :roll:
... and you are overhelming me with information... Ill'try to digest it! :|

Quote
(from Matthias)
"Sitemap v.2.8 supports the following informations wich you easily can use at the place you want."

"I like the show_menu2 because it is fast (only on database request) and flexible for all things that are needed."

(from Brodie)
"If you do want to use it then do the same as above replacing show_menu with
with show_menu2. To use sm2 with UDM see succhi's comment above.
http://forum.WebsiteBaker.org/index.php/topic,2584.msg20067.html#msg20067"

(from Succhi)
"You're quite right about the whole sitemap thing. [...]"

@Matthias Brodie Succhi

Thanks a lot for your advice... I will have a look at the standard sitemap 2.8...
if it meets my need,.... I will switch back to standard show_menu
and standard sitemap.

I believe Brodie's show_menu2 beiing great, but for me, with my
limited knowledge... the regular menu + sitemap are more easy handle...  :wink:
nevermind, thx to you all!  :-D

Cheers
Virgil
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: succhi on May 08, 2006, 01:18:38 PM
Hi All, next update should help everyone.

@virgil
Please note the following change for showing all menus. The SM2_MULTIMENU no longer works. SM2_ALLMENU is now passed as the first parameter (not as a flag) which is usually the menu number you want. The menu is cached as usual.

@phil
By default you will have access to two css classes at the start and end of each group of siblings. If you have put item tags in (eg <li>, <span> etc) you will get class="menu-first" and class="menu-last" to fine tune layouts that depend on different beginnings and endings. You no longer need to pass the SM2_FIRSTLAST flag, it is now default

@virgil, melissa
There is a new flag that supresses topMenuOpen from getting class="menu-top" being added to it. The second from last parameter is $aTopMenuOpen and this is where you can specify what you want your topmost element to be e.g. <div id="my-id" class="my-class"> or <ul  id="my-id" class="my-class"> etc. It over-rules the $aMenuOpen tag for use at the very top. However to stop menu-top from being added to the class you need to pass a new flag SM2_TOPMENU. You can now pass SM2_TOPMENU as a flag along with "<ul id='udm' class='udm'>" (for $aTopMenuOpen) and get only that at the top.

The new update is 3.0b6
Please let me know if there are any problems. Documentation will follow later when Brodie is back on board.

Stuart



[gelöscht durch Administrator]
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 09, 2006, 04:12:02 AM
Seems I have nothing better to do. Quick release of beta 7. See http://code.jellycan.com/show_menu2/
Doco updated. Flag for the top menu (SM2_TOPMENU) removed. If you supply a top menu item then it is used verbatim.
Should work with UDM4. Back to you Stuart...

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 22, 2006, 01:32:41 PM
Final beta release before final release of 3.0

Following are the changes:
[ul]
[li]Argument list has had final change. Now uses itemOpen, itemClose, menuOpen, menuClose like existing show_menu.
[li]Classes are not added automatically to tags anymore. You must designate the tag to receive the class by adding the [class] keyword. Note that this is different to show_menu in that it doesn't add class="", only the class list. Therefore use something like, '<ul class="[class]">'.
[li]Added the [class] keyword, as well as [li] and [ul] for the standard item and menu open tags.
[li]Using UDM4 for the popup menu demo on the test site
[/ul]

See http://code.jellycan.com/show_menu2/ for download and readme file.

Note that version 3.0 of show_menu2 can be used by other functions to recurse through tree for them and make use of the cached data and single SQL query. See legacy.php file for examples of how this is done (call show_menu2 from inside your own function and supply your own formatter class).

If there are no bugs or changes required, this will be the 3.0 version.
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 28, 2006, 09:23:31 AM
Re-released the final beta as version 3.0

Question:
Show show_menu2 be calling htmlspecialchars() on the page title, menu title, description, etc. The original show_menu doesn't, but it seems to me that it puts too much responsibility on the user to know that they need to write &amp; instead of a single &. Plus if they put angle brackets in their text it will possible screw up the output.

Does anyone use this "feature"? I think that I should be calling at least htmlspecialchars. See the demo site at http://code.jellycan.com/sm2test/ for an example. The page is called "<b>Bold</b> & <i>Italics</i>".

Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: melissa on May 28, 2006, 01:25:29 PM
Wow guys. I am so impressed.

This is the first time I've had a chance to come back to show_menu2 to see if I can use it with UDM, and I see you even have a demo of using UDM to make it really easy for me!

succhi and brofield, thanks for your hard work on this code.

Here's one more demo -

Code: [Select]
show_menu2(3, SM2_ROOT, SM2_START, SM2_ALL,
'&nbsp;|&nbsp;<span><a href="[url]">[menu_title]</a></span>',
'',
'',
'',
'<span><a href="[url]">[menu_title]</a></span>',
'');

I'm using it for a menu at the bottom of the page (using multiple menus), and it comes up like this:

Privacy Policy | Terms & Conditions | Contact Us

Melissa.

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: succhi on May 31, 2006, 02:59:40 PM
@brofield

Mate I am trying to work out why the menu doesn't show when I am on a page with a PAGE_ID of 0. The search page is just such a page and the menu goes 'bye-bye'.

Any quick ideas?

Update:
I found part of the problem.
When the page_id = 0 $wb->page['menu'] is empty.

Code: [Select]
// fix up the menu number to default to the menu number
// of the current page if no menu has been supplied
if ($aMenu == 0) {
    $aMenu = $wb->page['menu'] == '' ? 1 : $wb->page['menu'];
}

That fixes part of it. However I now have a menu that is fully expanded. I need to fix this part now.

Update 2:
I have found where it starts to go funny but I am not sure what the best fix would be.

Code: [Select]
sm2_mark_children($rgParent, PAGE_ID, 1);
If PAGE_ID != 0 then it is fine, it marks things correctly however with PAGE_ID == 0 every single item gets marked so the entire menu gets expanded when recursed. What do you think the best fix is Brodie?

Update 3:
OK if I do the following I get the result I am after.
Code: [Select]
// mark all children of the current page
if (PAGE_ID != 0) {
   sm2_mark_children($rgParent, PAGE_ID, 1);
}
I know that search should have no children so lets not even go down the track of marking anything. That's fixed it for me, plus I set all the $wb->page[] settings that might not be set due to PAGE_ID == 0.

@Brofield. Let me know if you can think of a better way to fix these problems. It took me near two hours + to work out what all the different levels of arrays you've got going on were doing. doing print_r($array) stuff everywhere to visualise what was happening.

Stu.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 31, 2006, 05:40:45 PM
@succhi
Thanks for the debugging work. It can be a real a b**** to work on someone else's code. Your solution seems fine to me. It sounds like there are more changes than what you have in this post, did you want to email the changed files to me? I'll roll it up and release it.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on June 01, 2006, 03:09:24 AM
New version available at http://code.jellycan.com/show_menu2/

* Fixes for menu display on special pages (e.g. search results page) as provided by succhi
* New flag SM2_NOCACHE to force a new read from the database

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: peppelorum on July 03, 2006, 10:17:53 AM
Added two short snippets so that the root items gets a class of their own.

[gelöscht durch Administrator]
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: travisfisher on July 05, 2006, 03:48:26 PM
What is the best approach for a site that has the need for the default menu CSS (menu-top, etc.) for multiple menus (1,2,3)?
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: kweitzel on July 05, 2006, 06:41:39 PM
wrap the menus in different DIVs ... for design check out css.maxdesign.com.a u they have listamatic and listamatic2 (1 for simple lists and 2 for nested lists).

cheers

Klaus
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: succhi on July 06, 2006, 03:55:18 AM
You can also add your own 'id' to the first element without having to wrap. e.g. <ul id="topbar">... and another could be <ul id="sidebar">...

Stuart.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on July 11, 2006, 11:09:48 AM
Added two short snippets so that the root items gets a class of their own.

You don't need this change. You can do this using the original show_menu2. Try supplying the SM2_NUMCLASS flag and then root items will have the menu-0 class. Or without using the SM2_NUMCLASS flag, you add the menu level in the format string manually. For example, something like "<li class='menu-[level] [class]'>". Again root items with have the menu-0 class.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: marccouture on July 28, 2006, 02:54:17 PM
Hi,

Reading through this thread, I haven't come across a non-coders' perspective on using this snippet.  Can someone explain how to integrate this in, say, the Simple template that is included in WB and change the default display of the left-hand side menu?

Thanks!
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on July 28, 2006, 07:44:29 PM
Hello,

using this replacement function is very easy. Download the last version, install the zip file as a modul and replace the menu call in the template (show_menu, page_menu or menu) with show_menu2. Thats all. If there are some arguments in the brackets after the call ( f.e. (0,1,1) you can use this with the replacement function too without any problems. To get the whole functions working it is better to replace this arguments with the new ones. Look at the readme.txt wich comes with the modul.

With these arguments you can change f.e. the default display of the left-hand side menu. So if you can describe what you want i'm pretty shure we can give you some hints. It's really not difficult because very logical structured.

Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: berndn on July 31, 2006, 12:40:51 PM
I like it and have only one problem.
Can this be implemented http://examples.codecharge.com/CCSExamplePack2/VerticalCSSMenu/VCSSMenu.php ?
I have serious trouble with this.
Can someone help ?

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on July 31, 2006, 01:13:31 PM
Hello,

what's your problem with this?

Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: berndn on July 31, 2006, 01:24:48 PM
I want to create this kind of list:
Code: [Select]
<div id=menu><ul id=menuList><li><a href="#" name="submenu" class="submenu">Products</a><ul><li><a href="#">All</a></li>
<li><a href="#">CodeCharge</a></li>
<li><a href="#">CodeCharge Studio</a></li>
<li><a href="#">DemoCharge Studio</a></li>
<li><a href="#" name="submenu" class="submenu">Comparison</a><ul><li><a href="#">CodeCharge Studio</a></li>
<li><a href="#">DemoCharge Studio</a></li></ul></li>
</ul></li>

But all my tries lead to garbish :)
Anyway to dump the show_menu2 output into an php array or is this to complicated :D
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on July 31, 2006, 04:57:21 PM
I want to create this kind of list...
But all my tries lead to garbish :)

Please read the documentation at http://code.jellycan.com/show_menu2/  In any case, that looks pretty much like the default output. Exactly what are you trying to do that is different to the default? If you want the class="submenu" when the menu has sub-menus then you just need to change your code to expect the class "menu-expand" and there you have it. There is no easy way to get the name="submenu" added when there is a submenu without writing your own output function. See legacy.php in the sm2 zipfile download for an example of a custom output function.

Anyway to dump the show_menu2 output into an php array or is this to complicated :D

Again, have a look at writing your own custom output function if you really want it output as an array. I expect that you are looking to over-engineer the problem though. You just need to read the documentation better.

Give us a clear explanation of the problem and we might be able to help you.

Regards,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: berndn on August 01, 2006, 09:52:42 AM
Thanks for the tips so far. I would need the name="submenu" for the javascript which is needed for Internet Explorer.
I looked into the legacy.php but I'm not sure how to use it. I enable the legacy.php with the include.
After I do this what has changed. Do I need to call show_menu2 with what parameters or what do I have to do ?
If you wish we can talk about this via email or pm instead of me asking silly question in this thread ;)
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 01, 2006, 04:52:18 PM
Version 3.5 now available at http://code.jellycan.com/show_menu2/


B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 01, 2006, 04:54:59 PM
A custom output class takes callbacks from the sm2 menu engine and formats that data for output. The legacy.php file defines a new function sm2_show_menu() which attempts to recreate the call signature of the show_menu() function using a custom output class. It is an example of how to call show_menu2 with a custom output class, not a final solution for you.

Instead use show_menu2 version 3.5 and use the conditional formatting. See the http://code.jellycan.com/sm2test/ website, "Conditional" for an example of what you want to do.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: berndn on August 01, 2006, 06:58:36 PM
Thanks a lot for your explanation. I wasn't sure that it was so easy to use the custom output filter in the version I used. Thanks for this :)

And thanks a lot for the new version. Will try it  :-)
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: marccouture on August 03, 2006, 06:50:46 PM
brofield, you are a life saver.  Excellent work, thank you very much!
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 15, 2006, 10:18:15 AM
Version 3.6 now available at http://code.jellycan.com/show_menu2/


B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: valerie on August 20, 2006, 10:42:39 PM
Can showmenu2 work on a multi-level css menu? The one I'm looking at is by stu nicholls found here: http://www.cssplay.co.uk/menus/final_drop2.html

I can figure out one level but beyond that I'm not sure...

Here's the xhtml:

Code: [Select]
<ul>
<li><a class="drop" href="../menu/index.html">DEMOS<!--[if IE 7]><!--></a><!--<![endif]-->
<table><tr><td>
<ul>
<li><a href="../menu/zero_dollars.html" title="The zero dollar ads page">zero dollars advertising page</a></li>
<li><a href="../menu/embed.html" title="Wrapping text around images">wrapping text around images</a></li>

<li><a href="../menu/form.html" title="Styling forms">styled form</a></li>
<li><a href="../menu/nodots.html" title="Removing active/focus borders">active focus</a></li>
<li><a class="drop" href="../menu/hover_click.html" title="Hover/click with no active/focus borders">hover/click with no borders
<!--[if IE 7]><!--></a><!--<![endif]-->
<table><tr><td>
<ul>
<li><a href="../menu/form.html" title="Styling forms">styled form</a></li>
<li><a href="../menu/nodots.html" title="Removing active/focus borders">removing active/focus borders</a></li>

<li><a href="#nogo">FLYOUT third level &#187;<!--[if IE 7]><!--></a><!--<![endif]-->
<table><tr><td>
<ul>
<li><a href="#nogo">Third level-1</a></li>
<li><a href="#nogo">Third level-2</a></li>
<li><a href="#nogo">Third level-3</a></li>
<li><a href="#nogo">Third level-4</a></li>

</ul>
</td></tr></table>
<!--[if lte IE 6]></a><![endif]-->
</li>
<li><a href="../menu/hover_click.html" title="Hover/click with no active/focus borders">hover/click</a></li>
</ul>
</td></tr></table>
<!--[if lte IE 6]></a><![endif]-->
</li>

<li class="upone"><a href="../menu/shadow_boxing.html" title="Multi-position drop shadow">shadow boxing</a></li>
<li><a href="../menu/old_master.html" title="Image Map for detailed information">image map for detailed information</a></li>
<li><a href="../menu/bodies.html" title="fun with background images">fun with background images</a></li>
<li><a href="../menu/fade_scroll.html" title="fade-out scrolling">fade scrolling</a></li>
<li><a href="../menu/em_images.html" title="em size images compared">em image sizes compared</a></li>
</ul>

</td></tr></table>
<!--[if lte IE 6]></a><![endif]-->
</li>
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 21, 2006, 12:44:36 AM
You might be able to do something like that using conditions, but it looks like a pretty messy menu. Try one of the other CSS menus that don't need all of the table guff that this one does. An example using UDM is on the sample site. There are plenty of others too.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Francisco on August 24, 2006, 07:06:32 AM
 Hi there,

 I have just installed this module, changed my template to have:

show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL, false, "\n</li>", false, false, false, '<ul class="udm" id="udm">');

 instead of "SHOW_MENU"

 I get a list of pages in bare HTML, seems like the CLASS is missing. I am attaching a screenshot, for privacy reasons I blanked out the page names and everything that can be used to track the website using google.

 Excuse me my ignorance, but did I missed any steps? ~ I just changed the template menu code... maybe I didn't do it right.

 But I checked the source code of your DEMO page, it seems like you use JAVA SCRIPT... I don't know where to get those to get UDM working...

 This is what I modified/added in template:
Code: [Select]
<td width="100%" style="height: 173px">
                        <?php if(SHOW_MENU) { /* Only shown menu if we need to */ ?>
<?php show_menu2(0SM2_ROOTSM2_ALLSM2_ALLfalse"\n</li>"falsefalsefalse, &#39;<ul class="udm" id="udm">&#39;); ?>
<?php ?></td>

 Thanks

(http://www.upshizzle.com/gallery/albums/uploaded/8.06/udm.gif)
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 24, 2006, 07:18:58 AM
See the UDM website linked from that demo for details of how to set it up. My demo page is just showing that it can be used with sm2. http://www.udm4.com/

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 24, 2006, 08:04:27 AM
Version 3.7 now available at http://code.jellycan.com/show_menu2/


B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Francisco on August 24, 2006, 08:07:58 AM
See the UDM website linked from that demo for details of how to set it up. My demo page is just showing that it can be used with sm2. http://www.udm4.com/

B

 Sorry for being a pain.

 http://www.udm4.com/licensing/download/ - I get the .zip from there.

 Now what do I need to upload/modify in the Template? If you can tell me the basic things that have to be done to get a standard UDM menu it will help me get an idea of what I need to do.

 I just need the basic steps after downloading the .zip ... if you could, please tell me.

Thanks
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 24, 2006, 08:21:12 AM
Do your own work. See the UDM site. Read the manual.
http://www.udm4.com/manual/quickstart/
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ami on August 27, 2006, 11:24:07 AM
Hi Brodie, hi all

really a great snippet. I got it to work as I want:
One vertical menu for the root, a second menu for the root+1. I took the code from your demopage:

Code: [Select]
<div class="root">
<?php show_menu2(0SM2_ROOTSM2_START); ?>
</div>
<div class="second-menu">
<?php show_menu2(0SM2_ROOT+1SM2_START); ?>
</div>

To get it correct for xhtml strict (without target=...) I changed $aItemOpen like this:
Code: [Select]
<?php show_menu2(0SM2_ROOTSM2_STARTSM2_PRETTY, &#39;[li]<a href="[url]">[menu_title]</a>&#39;); ?>
Then there is a mistake I do not understand - what I am coding wrong?
-> On every page I see the children of all root-entries in the second menu, for every entry of root a complete UL.

The same, if I just use the flag SM_PRETTY (no other $aItemOpen). Is there something I don't see?

Only your demo like above shows the correct children of root depending to the actual page.

Thank you for this modul - may be you can identify my mistake.
Axel

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 27, 2006, 11:28:53 AM
You are not supplying the SM2_TRIM flag. The default is SM2_ALL. Combine it with the pretty flag with a vertical bar. i.e. SM2_TRIM|SM2_PRETTY
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ami on August 27, 2006, 11:37:20 AM
Wow, really fast answer!
So easy, I just did not see that. And I tried a lot...  :|

But whats about the default in <?php show_menu2(0, SM2_ROOT+1, SM2_START); ?>? Why does it work there as I want?

Thank you again!
Axel
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 27, 2006, 11:44:45 AM
Sorry, what I said was confusing. Because the SM2_ALL flag uses the value of 0, it is the same as if it isn't specified at all. Therefore, if you supply some flags (like SM2_PRETTY), but don't supply one of the flags like SM2_TRIM, then it will use SM2_ALL. This is different to if you don't supply the flags parameter at all. Because at that time, you get the default value, which is SM2_TRIM.

In summary, always supply all flags.

In the next version I will change it so that if you don't supply one of the required flags then it will generate an error.

B

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ami on August 27, 2006, 11:48:01 AM
Cool!
there are too many features in your module...   :roll: :-D

Keep on, its great and really flexible.
Greetings, Axel

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 27, 2006, 12:50:48 PM
Version 3.8 now available at http://code.jellycan.com/show_menu2/


B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Tim on August 30, 2006, 07:52:14 AM
Hi Brofield,

I'm implementing another WB installation and using your wonderful code snippet :) This particular one has two menus - a top menu and a side menu. The top menu is all the root level pages. The side menu is related to that particular "area" of the page.

However I have one question - is there a way to make a menu such that if that page has children, its children are displayed, and if you go to one of those children, that menu changes to show that pages siblings?

In effect, that once you're in that "area" of the site, the menu will stay the same regardless of whether you're on the root page or one of the children.

The more that I think about it actually this is more of a php question...

Oh! Also. I found it useful to hack your code so that it would recognise [nbsp] as a spacer in the menu code. Saves having to use those annoying | vertical slashes to seperate menus. Just thought I'd share. ;)

Cheers,
Tim
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 30, 2006, 08:14:20 AM
However I have one question - is there a way to make a menu such that if that page has children, its children are displayed, and if you go to one of those children, that menu changes to show that pages siblings?

You are always wanting to show the menu from the first level down, regardless of the currently selected menu. Therefore start is ROOT+1. Depth is to CURR+1.
show_menu2(0, SM2_ROOT+1, SM2_CURR+1);

See http://code.jellycan.com/sm2test/pages/enterprise.php  "Children/Siblings"
 
Oh! Also. I found it useful to hack your code so that it would recognise [nbsp] as a spacer in the menu code. Saves having to use those annoying | vertical slashes to seperate menus. Just thought I'd share. ;)

Why? Just enter &nsbsp; directly into the format string. It isn't escaped by sm2.
e.g.
show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL, false, false, '&nbsp;&gt;&nbsp;<ol>', '</ol>');

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Tim on August 31, 2006, 05:09:50 AM
EDIT: I fixed it. I was still running an old version of show_menu2. (2.3.6) Cheers!

Hi Brofield,

Thanks for the reply. I must have missed that before! I do have one question though. When I implement this, it shows not only all the siblings of that page, but it shows all the pages at that level (ie pages that are children of a root page). Regardless of what page I'm on, I get a giant listing of all the pages which have a root page as a parent, even at pages which have no children.

This would be the equivalent, using your jellycan example, of always having a children/sibling menu which read "Jams, Cogs and Wheels, Large Objects, Small Objects, Procrastination, Drugs, Bold and Italics" regardless of what page you were on.

Yours however does the correct thing - when it's at a root page with no children, no menu comes up. However, I can't get mine to go away :(

Also, the

show_menu2(0, SM2_ROOT+1, SM2_CURR+1);

doesn't work for me unless I put a ' ', in there, e.g.

show_menu2(0, SM2_ROOT+1, SM2_CURR+1, ' ', [insert formatting stuff here]);

Without the spacer I just get the formatting stuff printed as text. What causes that?

Thanks for your patience.
Tim
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: learning on August 31, 2006, 07:49:52 AM
I have been struggling with two issues for a few days now, and the worst part is, I am worried there are going to be a very simple solutions that I am missing. After much searching, and experimenting, I am finally posting... hopefully in the right area.

Issue 1

I had a menu structer that was working fine, however it would not function correctly in Fire Fox, so I converted to show_menu2. The menu itself, now displays and functions correctly... however one issue. The current menu css will not work. I have tried many different combinations and I just can not seem to get it to work. (again it was working fine with show_menu). I have included my css for my menu.. not sure if it will help or not.

Please not the 'current' css that I have quoted here is not all that I have tried, it is just the last one that I tried. I am sure this is something simple that I just can't figure out... sorry to be a bother. I can include the view source from my page if that helps too.

Code: [Select]
#menu {
padding: 0;
margin: 0;
}

#menu a {
text-decoration: none;
display:block;
}

#menu ul {
padding: 0;
margin: 0;
list-style: none;
}

#menu li {
margin: 0;
padding: 0;
font-size: 11px;
font-family: Arial;
}

#menu ul li a {
margin-top: 8px;
padding: 0 28px;
height: 21px;
line-height: 21px;
font-weight: bold;
text-transform: uppercase;
border-top: 1px solid #AACCD5;
border-bottom: 1px solid #AACCD5;
background-image: url(li1a.gif);
background-position: 13px 5px;
background-repeat: no-repeat;
}
#menu ul li a.menu-current{
margin-top: 8px;
padding: 0 28px;
height: 21px;
line-height: 21px;
font-weight: bold;
text-transform: uppercase;
border-top: 1px solid #AACCD5;
border-bottom: 1px solid #AACCD5;
background-image: url(li1a-c1.gif);
background-position: 13px 5px;
background-repeat: no-repeat;
background-color: #FAF9D0;
}
#menu ul li ul li a {
margin-top: 0;
height:19px;
line-height: 19px;
font-weight:normal;
text-transform: capitalize;
background-image: url(li2.gif);
background-color: #DEECF0 ;
background-position: 13px 5px;
background-repeat: no-repeat;
border-top: 1px solid #EEF5F7;
border-bottom: 1px none #EEF5F7;
}
#menu ul li ul li a.menu-current{
margin-top: 0;
height: 19px;
line-height: 19px;
font-weight: normal;
text-transform: capitalize;
background-image: url(li2-c1.gif);
background-color: #FEF2B9;
background-position: 13px 5px;
background-repeat: no-repeat;
border-top: 1px solid #EEF5F7;
border-bottom: 1px none #EEF5F7;
}

Issue 2.

I have a 'members' page... set to registered, and it wont show on the menu unless I am logged in.  From my searching I can see that only 'private' pages should have this behaviour. Is there something I am doing wrong, or is it something to do with implementing show_menu2?

Sorry again to be a pain, I just thought it was time to post before I didn't have ANY hair left!!

Cheers
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 31, 2006, 07:53:29 AM
Issue 1
If you are using the default format then the menu-current class is assigned to the <li> element, not the <a> element.

Issue 2
Surely this is what it should do? Pages only available to registered users will only appear in the menu if the registered user is logged in.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: learning on August 31, 2006, 08:08:11 AM
Issue 1
If you are using the default format then the menu-current class is assigned to the <li> element, not the <a> element.

Issue 2
Sure this is correct? Pages available to registered users only will appear in the menu only to registered users.

B


Thank you for your ultra fast response!!

Ok... that will give me something more to work with on Issue 1... could be my problem  :oops:

Now... with Issue 2... hmm... maybe I got it mixed up as to what it should do. If that is normal behaviour for registered pages, then maybe it is private pages I need, however I have tried both. Neither will show in the menu unless I am signed in. I want the link to be visible to all, but when the link is clicked on the person then needs to sign in before they can view the contents. Sorry if I didn't explain that very well.

Cheers
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 31, 2006, 08:26:40 AM
Update: this table now shows what SM2 is displaying. As far as I have investigated, this is the same as the output of show_menu().

Page TypeMenu VisibilityPage VisibilitySearch Results
PublicEveryoneEveryoneTrue
RegisteredEveryone *1 (or)
Logged in user in correct group *2
Logged in user in correct groupTrue
PrivateLogged in user in correct groupLogged in user in correct groupTrue
HiddenNeverEveryone, but only if they know the page URLTrue
NoneNeverEveryone, but only if they know the page URLFalse

Note:
*1 if General Settings -> Login = Enabled
*2 if General Settings -> Login = Disabled

Note: in regards to Hidden and None types, security by obscurity is no security at all. Use this for developing pages before making them live but never assume that those pages are private.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: learning on August 31, 2006, 08:31:12 AM

Hi There,

Yep that is what I was thinking would happen with registered pages. I just went and checked again, and it is a page set to 'registered' and it is only viewable on the menu if someone is logged in.

Cheers
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 31, 2006, 09:06:35 AM
SM2 uses the same SQL limit as show_menu() and menu(), so SM2 will have the same output as them. This sql limit eliminates private pages from the output when you are not logged in. It eliminates registered pages from the output if there is no frontend login (refer admin settings).

I guess if you are not seeing "Registered" pages when you are not logged in, then you probably don't have frontend login enabled.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: learning on August 31, 2006, 09:25:39 AM

 :oops: Like I said, something very simple that I was missing. Thank you.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: kweitzel on August 31, 2006, 09:56:53 AM
Hi all, from what I know about WB, the table about the visibility settings above is correct. Therefor I added that table to the WIKI page "More on Pages (http://projects.WebsiteBaker.org/websitebaker2/wiki/Docs-EN-More-on-Pages-Modules)". Thanks brodie for your work!

cheers

Klaus
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: learning on September 01, 2006, 01:40:25 AM
Thanks for that Klaus (I feel rather silly that it was something I had missed :oops:), and yes thank you Brodie for your great work  :-D

At the risk of embarrassing myself further, I am still having troubles with the 'current menu' issue. I did as suggested earlier, and I can now get the 'current' to display properly... almost! Problem I have is, when I click on a page that has child levels, all items show as current 'in the parent form' and then to click on a child level, it restores to how it should be layed out.

For instance if this is how it should display..

Item 1
Item 2 (current)
      item 2a
      item 2b
Item 3

But it displays like this

Item 1
Item 2 (current)
Item 2a (child of current, should be small and indented)
Item 2b (child of current, should be small and indented)
Item 3

When I click on a child, it all then restores to the proper display.

I have included my css, and the html from the view source of the page.

Menu Call
Code: [Select]
<?php show_menu2(); ?>
CSS
Code: [Select]
#menu {
padding: 0;
margin: 0;
}

#menu a {
text-decoration: none;
display:block;
}

#menu ul {
padding: 0;
margin: 0;
list-style: none;
}

#menu li {
margin: 0;
padding: 0;
font-size: 11px;
font-family: Arial;
}

#menu li a {
margin-top: 8px;
padding: 0 28px;
height: 21px;
line-height: 21px;
font-weight: bold;
text-transform: uppercase;
border-top: 1px solid #AACCD5;
border-bottom: 1px solid #AACCD5;
background-image: url(li1a.gif);
background-position: 13px 5px;
background-repeat: no-repeat;
}

#menu li.menu-current a {
margin-top: 8px;
padding: 0 28px;
height: 21px;
line-height: 21px;
font-weight: bold;
text-transform: uppercase;
border-top: 1px solid #AACCD5;
border-bottom: 1px solid #AACCD5;
background-image: url(li1a-c1.gif);
background-position: 13px 5px;
background-repeat: no-repeat;
background-color: #FAF9D0;
}
#menu li li a {
margin-top: 0;
height:19px;
line-height: 19px;
font-weight:normal;
text-transform: capitalize;
background-image: url(li2.gif);
background-color: #DEECF0 ;
background-position: 13px 5px;
background-repeat: no-repeat;
border-top: 1px solid #EEF5F7;
border-bottom: 1px none #EEF5F7;
}
#menu li li.menu-current a {
margin-top: 0;
height: 19px;
line-height: 19px;
font-weight: normal;
text-transform: capitalize;
background-image: url(li2-c1.gif);
background-color: #FEF2B9;
background-position: 13px 5px;
background-repeat: no-repeat;
border-top: 1px solid #EEF5F7;
border-bottom: 1px none #EEF5F7;
}

HTML view source
Code: [Select]
<div id="menu">
<ul class="menu-top">
<li class="menu-sibling menu-first"><a href="#" target="_top">Home</a></li>
<li class="menu-expand menu-current"><a href="#" target="_top">Services</a>
<ul class="">
<li class="menu-child menu-first"><a href="#" target="_top">Pricing Guide</a></li>
<li class="menu-child menu-last"><a href="#" target="_top">Hosting Plans</a></li>
</ul></li>
<li class="menu-sibling"><a href="#" target="_top">Portfolio</a></li>
<li class="menu-expand menu-sibling"><a href="#" target="_top">About Us</a></li>
<li class="menu-sibling"><a href="#" target="_top">Contact Us</a></li>
<li class="menu-sibling"><a href="#" target="_top">Site Map</a></li>
<li class="menu-sibling menu-last"><a href="#" target="_top">Members</a></li>
</ul>

Sorry to be a pain, I am not the worlds best at coding, infact I really have no idea at all, but I will try any and all combinations before calling for help. These are just the last ones tried and the result. I have tried other call menu options too.

Thanks again.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on September 01, 2006, 02:14:33 AM
Try changing the class to the <a> tag. Your CSS rules then apply to a.menu-current and don't cascade to the rest. Example:
itemOpen = '<li><a class="[class]" target="[target]" href="[url]">[menu_title]</a>'

In future, note that this thread is for discussion of the SM2 output and possible bugs, like your original post. Not for CSS problems.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: learning on September 01, 2006, 02:34:35 AM


oops... sorry.  :oops:

Thanks for your response. I will try to nut through that and see how I go.

Cheers

*mods - Please feel free to move my previous post and reply if need be.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: succhi on September 27, 2006, 03:00:25 PM
@brofield. I am finding my registered pages showing in my menu even with login enabled (show_menu2-3.8).

update: Woops, they are supposed to show. I forgot the difference between registered and private is that registered appears in the menu but you must be logged in to view, private you don't see in the menu at all until you are logged in.

Please forget the rest of my post unless you want registered pages to not show in your menu.

The following alterations fixed my problem so they no longer show

From this:
Code: [Select]
                if (($page['visibility'] == 'private' || $page['visibility'] == 'registered')
                    && false === strstr(",{$page['viewing_groups']},", $currGroup))
                {
                    continue;
                }

To this:
Code: [Select]
if ($page['visibility'] == 'private'
                    && false === strstr(",{$page['viewing_groups']},", $currGroup))
                {
                    continue;
                }

Stu.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: yppds on October 25, 2006, 10:31:36 AM
Hi!,

I know that the issue of show_menu2 has been extensively discussed in the forum, but I’m pretty desperate and need your help, after 5 hours of searching.

It is a multilingual site that has the following tree structure:

en
->home page
->News
->->news1
->->news2
->Pictures
->->Pictures 1
->->Pictures 2
de
->startseite
->Neues
->->neues1
->->neuses2
->Bilder
->->Bilder1
->->Bilder2

This site uses both show_menu2 and udm.

When the user is on the English page he will see only the English menu. When in deutch, he will see the deutch menu. To make it multilingual, I have followed – successfully - the tutorial that is posted on the wiki of WebsiteBaker and I have used the following to display the menu: show_menu2(0, SM2_ROOT+1, SM2_ALL, SM2_TRIM, false, false, ‘<ul class=”udm” id=”udm”>’);

Everything works fine. The problem starts when you click for instance on the Pictures1 link of the menu. The Pictures menu is becoming activated, but the News menu is becoming deactivated (it is shown, but you have to click on it, to show you the children of the menu). Also, assuming you click on News1, then the Pictures menu is becoming deactivated and you can only see the children if you click on it.

All I want is to make the menus always visible and activated, nomatter which route the user chooses.

Any help would really be appreciated.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: kweitzel on October 25, 2006, 03:54:17 PM
Haven't used that menu style myself, but from my understanding this is how it is supposed to work, actually ...

You can look for the breadcrumbs function to give you that page trail you would like to see (or as well the show_menu2 function).

cheers

Klaus
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: yppds on October 25, 2006, 04:13:05 PM
Hi Klaus

Thanks for you help!

Well, after many trial and errors, I figure out one simple thing that might help you to guide me.

All I want is to make the menu always stay expandable. I don't want it to collapse.

The problem starts when you move from one category to the other. When you choose the Pictures category, it hides the News category (and all children) and shows only the contents of the Pictures menu category.

Could it be that the problem I have relates more with PHP code in include.php or legacy.php , than with how you type the show_menu2 function?

Looking forward for your help.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: kweitzel on October 25, 2006, 05:31:07 PM
you might be right three ... why don't you have a look at the source view of some redered pages ... then you will see if it is or not ... in general the menu function "resets" on every page loaded.

But also, these kind of menus are usually designed, that they do exactly that ... maybe it is not the right menu for you ... have you looked for explanations about the UDM Menu?

cheers

Klaus
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on October 25, 2006, 07:50:50 PM
Seems to me that you want to use SM2_ALL instead of SM2_TRIM. Not sure that UDM is what you want either, since UDM is about create popup menus and you want to show the entire site structure all of the time.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: yppds on October 26, 2006, 07:35:24 AM
Thanks Brofield and Kweitzel for your responses.

@Brofield: You are right and perhaps it wasn't clear enough what I needed.

The reason I use UDM, is exaclty because I want to present popup menus!

Imagine that you have the structure I wrote before. My menu can only afford 3 links in the main page ( Home Page, News and Pictures). Here is the issue:

1. I use SM2_ROOT+1, because I don't want to display the EN and DE pages. I deal with them as described in the wiki of WebsiteBaker. This works great.

2. So when the page loads, you can see the above 3 links and an arrow on the left of the 2 categories that have sub-links. When you mouse over the News category for instance, a popup window will be displayed to show News1 and News2 links. This is great and works fine. The problem starts when you click for instance on News1 link. Then the arrow on the PICTURES category is hidden/collapsed and you can only see the menu of the News category. This is my problem! Why it has to collapse, since the popup menu should always be expanded, nomatter which sub-link of a category you choose.

3. I use SM2_TRIM because I only want to show the contents of the EN page or DE page depending on language selection. Also, mind you that I only have space for 3 links! These links are different, 3 for English and 3 for Deutch, but they can be arranged to show properly only using the SM2_TRIM function.

I guess what I'm looking for is an modification that will help many folks when trying to create a multilingual site with popup menus.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: yppds on October 26, 2006, 10:02:06 AM
Hi,

I guess I have figured a way to overcome this issue, but I would like your help on the following:

Below is the site structure :

en
->home page
->News
->->news1
->->news2
->Pictures
->->Pictures 1
->->Pictures 2
de
->startseite
->Neues
->->neues1
->->neuses2
->Bilder
->->Bilder1
->->Bilder2

How can I make it using show_menu2 to show when clicking the English language only the English menu and when clicking the Deutch site only the Deutch menu. Currently I'm using the following:
show_menu2(0, SM2_ROOT+1, SM2_ALL, SM2_ALL, false, "\n</li>", false, false, false, '<ul class="udm" id="udm">');

Any help would be greatly appreciated.

THanks again guys1
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: kweitzel on October 26, 2006, 04:42:05 PM
On my sites weitzel.info/nethome and weitzel.biz I created menu links to the language top pages refering to the language homepage.

Then, i think you would use following SM2 Code:

Code: [Select]
1) show_menu2(0, SM2_ROOT+1, SM2_CURR+1);
2) show_menu2(0, SM2_ROOT+1, SM2_CURR+1, SM2_ALL, false, "\n</li>", false, false, false, '<ul class="udm" id="udm">');

1) Is the original "Children/Siblings" code from the SM2 Page
2) I think would be your UDM Code for that issue

Additionally a browser redirect script in the intro page (beware of the issues with it!) which selects one page by default (or, if you have the script also to select basesd on browser language).

cheers

Klaus
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on November 02, 2006, 02:00:07 AM
Version 3.9 now available at http://code.jellycan.com/show_menu2/


B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: dw2006 on December 19, 2006, 12:45:03 PM
Hi,

this is a very fantastic tool and I thank you!

One question: I would like to display ONLY the siblings of the current page, yet not the current page and nothing else. Is there an easy way to do that?

Currently I am using the following code, which shows ALL sublings within the category:

Code: [Select]
show_menu2(0, SM2_CURR, SM2_CURR, '','- [a][menu_title]</a><br>','','','<br>'); 

Thanks, greetings, and happy holidays/christmas/chanukkah/kwanzah/festivus etc.!   
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on December 19, 2006, 01:00:03 PM
Sure. Use the conditional formatting and exclude the current item.

show_menu2(0, SM2_CURR, SM2_CURR, '','[if(class!=menu-current){- [a][menu_title]</a><br>}]','','','<br>'); ?>

For it working, see http://code.jellycan.com/sm2test/
Search for the test case "Show only siblings (not current)"
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: dw2006 on December 19, 2006, 01:15:19 PM
Wow, now that was a lightening fast response. Thanks!

To quote Steve Jobs: One more thing ;-) ...
Is there a way to have the name of the parent in the menu's header?

What I mean is a result like:
Code: [Select]
Other pages in the category "XYZ" are:
- sibling
- another sibling

(Right now it is "other pages in this category" without saying what category it currently is...)

Greetings and Thanks again! :)
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on December 19, 2006, 01:21:51 PM
Probably. What you are trying to do is call sm2 such that it only outputs the title of the current page. i.e. change the output format to show only the page name. Then restrict the processing to only the current level. Then use conditional formatting to exclude everything except the current page. I'll leave the actual code as an exercise in thinking for yourself.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: dw2006 on December 19, 2006, 01:28:41 PM
thanks for showing the logic of this. Something for me to do over the holidays!   I will feel like a real hacker! ;-)
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on December 19, 2006, 03:48:14 PM
Actually no. I missed that you wanted the parent page. The current page is available via PAGE_TITLE, but the parent page isn't and I don't think that there is a way to get it via the current SM2. Try the new version 4.0 and see the example at http://code.jellycan.com/sm2test/pages/conditional/show-only-parent.php
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on December 19, 2006, 03:50:40 PM
Version 4.0 now available at http://code.jellycan.com/show_menu2/


B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: kweitzel on December 19, 2006, 03:53:47 PM
That sounds like a good update, thanks ... downloded it and will have a look later.

cheers

Klaus
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: berkeweb on January 06, 2007, 09:53:05 AM
Hi,

I am a WB-Newbie and I have installed the show_menu2 code snippet and it works fine. But I want to make some changes to the menu layout but I am not quite sure how. Here is the menu as it looks now:

(http://www.berkeweb.de/screen_shot.jpg)

I would like to replace the bullet points with an image. How can I do that and where do I have to make the necessary changes: include.php or legacy.php or screen.css or index.php?

I hope you can help with this and I thank you for your support in advance.

Take care

Axel
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: kweitzel on January 06, 2007, 10:01:29 AM
Hi Axel, it is the screen.css file, where you make the required changes. Please have a look ath the sourcecode of a rendered page to find out the css classes.

A good resource for styling with lists is css.maxdesign.com.a u There you find listamatic (simple lists) and listamatic 2 (nested lists, what you need here) also they have a listutorial which is quite good.

cheers

Klaus
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: berkeweb on January 06, 2007, 02:42:53 PM
Hi Klaus,

thank you for recommending css.maxdesign.com.a u this is a very good css source and it helped me a lot so far. But still I have a question since my menu looks far better than this morning but there is one little thing that I cannot find a solution for:

(http://www.berkeweb.de/screen_shot2.jpg)

As you can see, the sub menu items "Projekt 1 and "Projekt 2" are not in order since they belong to the main menu item "Projekte". And the "Shop" item should be the next main item and not somewhere inbetween. Also the line-spacing is not quite similar between the main items and the sub menu items. Do have an idea how to fix these problems?

Here is the css-code for the menu posted above:

Code: [Select]
ul
{
margin-left: 0;
padding-left: 0;
list-style: none;
}

li
{
padding-left: 32px;
padding-top: 17px;
background-image: url(zahn_single.png); height: 35px;
background-repeat: no-repeat;
background-position: 0.1em;
}

.menu {
}

.menu a {
font-size: 14px;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #ffffff;
font-weight: bold;
vertical-align: middle;
text-align: left;
text-decoration: none;
background-position:left;
background-repeat:no-repeat;
padding: 2px 0px 2px 2px;
height: 35px;
}

.menu a:hover {
font-size: 14px;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #000000;
font-weight: bold;
vertical-align: middle;
text-align: left;
text-decoration: none;
background-repeat : repeat-y;
background : url(menu_hover.png) repeat-y left;
}

I hope that I am not annoying you with these beginner questions.

Take care

Axel
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: kweitzel on January 06, 2007, 09:45:27 PM
You are dealing here with a nested lists. So what you actually need is the "li li" selector ... have a look at maxdesigns nested lists model to get there.

What you see is the "misunderstanding" within the li-items. Because, if you look at the sourcecode, you will find, that the order of items is correct.

And please have a look at your charset settings ... there is also a lot of information in the german subboard about this ;-)

cheers

Klaus
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bgg on February 26, 2007, 04:07:47 AM
How can I display only the:

1. current level
2. child level

I want to "display the siblings of the current lebel only, including the current page also" on the left block: http://wb.asiasrc.org/

Thanks

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on February 26, 2007, 06:47:40 AM
Hello,

documentation you find here:

http://code.jellycan.com/files/show_menu2-README.txt (http://code.jellycan.com/files/show_menu2-README.txt)

Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: gavjof on March 14, 2007, 02:13:02 PM
Hi,

I'm using the following to show a site map for current level pages complete with descriptions:

Code: [Select]
// Site Map Menu Call
show_menu2(0, SM2_CURR+1, SM2_CURR+1, SM2_ALL|SM2_ALLINFO, '[li][a][page_title]</a> <br /><blockquote class="highlight">[description]</blockquote>', false, '<ul class="sitemap [class]">');

This works great with certain templates (tested with round but when I try using another template it only returns.

Quote
[description=UNKNOWN]

I tried changing the doctype, amongst other things but I'm still confused as to what is causing this. :|

Any ideas?

Cheers

gav
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on March 14, 2007, 03:05:30 PM
Hello,

Quote
using another template

Wich did you try?

[description] i think is a variable of WB wich has nothing to do with the template. But if you have no description of a page no descritpion could be displayed.

Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: gavjof on March 14, 2007, 03:10:16 PM
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: gavjof on March 14, 2007, 03:49:17 PM
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/ (http://code.jellycan.com/sm2test/)
Code: [Select]
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 14, 2007, 06:33:34 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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: gavjof on March 15, 2007, 12:44:38 PM
Nice one, I never read that far  :oops:
All good now.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: hobo_geek on March 22, 2007, 05:09:58 PM
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:

Code: [Select]
<select name="drop_menu">
<?php show_menu2(0SM2_ROOTSM2_START, &#39;<option value="[menu_title]">[a][menu_title]</a>&#39;, &#39;</option>&#39;); ?>
</select>

Any help will be appreciated. Thanks.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: kweitzel on March 22, 2007, 06:29:55 PM
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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: hobo_geek on March 28, 2007, 05:40:14 PM
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. 
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 29, 2007, 08:30:12 AM
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: hobo_geek on March 29, 2007, 07:54:02 PM
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     = '
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 30, 2007, 06:15:02 AM
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Danko on April 20, 2007, 08:22:27 PM
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on April 21, 2007, 10:37:05 AM
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:

Quote
http://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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Danko on April 21, 2007, 01:15:17 PM
Thanks Matthias.

It WORKS!  :lol:
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: nickleermans on April 28, 2007, 02:20:43 PM
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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: kweitzel on April 28, 2007, 06:37:24 PM
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
Title: This is perfect
Post by: gokcer on June 12, 2007, 12:04:02 PM
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Boboga on August 08, 2007, 09:10:55 AM
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? :)
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 15, 2007, 03:02:36 AM
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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: BerndJM on August 15, 2007, 01:33:38 PM
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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 18, 2007, 10:35:36 AM
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.

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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: lleighh2 on August 23, 2007, 10:59:24 PM
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 (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.

Code: [Select]
<?php show_menu2(0SM2_ROOTSM2_CURR+1, &#39;&#39;,&#39;[if(class!=menu){[a][menu_title]</a>}]&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39;); ?>
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 (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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: 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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: lleighh2 on August 24, 2007, 01:54:05 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:
Code: [Select]
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!!
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: lleighh2 on August 24, 2007, 04:14:51 AM
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:
Code: [Select]
<?php show_menu2(0SM2_ROOTSM2_START

&
#39;<ul>&#39; , &#39;<li class="menu">[a][menu_title]</a>&#39;, &#39;</li>&#39; , &#39;</ul>&#39;, &#39;&#39;, &#39;&#39;); ?>
   
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 24, 2007, 04:23:13 AM
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); ?>
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: lleighh2 on August 24, 2007, 11:04:53 AM
@brofield So sorry for upsetting you or for suggesting that my time was more important than yours. I just don't understand the documentation or the examples and i thought that since everyone else on this thread seems to be getting it and i'm not then i could draw on the collective success of you all. please forgive my faux pas. and thank you so much for your help.

btw. that's exactly what i've had in my css all along. not sure why it's not working. i try not to won't bother you again.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: nickleermans on August 29, 2007, 09:45:23 AM
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


This is my original post. And this is an answer:

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

I found out that with this:
Code: [Select]
show_menu2(0, 1, SM2_ALL, SM2_ALL); I can replace the second number (=1) with the number of the root. But how can I change this number when the menu is changing?

Can anyone find an answer to my original question?
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 29, 2007, 12:52:46 PM
Version 4.3 now available at http://code.jellycan.com/show_menu2/


See the new examples at the SM2TEST website:
"Tree rooted at parent item" showing use of the SM2_BUFFER flag
"Current Tree Only" showing use of the SM2_CURRTREE flag

http://code.jellycan.com/sm2test/pages/enterprise/cogs-wheels/cogs/little.php

nickleermans: use the SM2_CURRTREE flag as in the example.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on September 06, 2007, 02:48:14 PM
Version 4.4 now available at http://code.jellycan.com/show_menu2/

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: spida on September 06, 2007, 06:22:48 PM
Easiest way ... make 2 menu's (look for multiple menu in forum). Use standard menu call in template, just calling the menu numbers.

Hi Klaus and all,

I used the search for "multiple menu" but didn't find quite what I am looking for, thus I just ask here:
I have this site with three menus:
1. is the main navigation
2. is the subnavigation of second level pages
3. is supposed to be a service navigation with links to contact page etc.

I have it in index.php like this:
Mainnavigation:
Code: [Select]
<div id="navigation">
            <?php show_menu2(0SM2_ROOTSM2_START);?>
            </div>
Subnavigation:
Code: [Select]
<div id="rechtespalte">
            <?php show_menu2(1,SM2_ROOT+1SM2_START);?>
            </div>
Service navigation:
Code: [Select]
<div id="metanav">
            <?php show_menu2(219SM2_ALLSM2_ALL);?>
            </div>
My info.php says:
Code: [Select]
$menu[1]='Hauptnavigation';
$menu[2]='Subnavigation';
$menu[3]='Metanavigation';
and multiple menus is enabled in the admin.
Main and sub navigation both work properly, but pages I assign "Metanavigation" to in the page's prefernces are simply not shown in any of the menus.

I also tried
Code: [Select]
$menu[0]='Hauptnavigation';
$menu[1]='Subnavigation';
$menu[2]='Metanavigation';
in the info.php with the same negative results.

The navigations' "physical" order in the html is:
meta navigation first
then main menu
and after that sub menu

... don't know whether this is of relevance.

Obviously I have still not understood the menu2 stuff completely and would some help appreciate very much.

Thanks in advance,
Ayshe
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on September 06, 2007, 06:37:59 PM
If I understand you correctly, you want to have
1) root level menu
2) child menu
3) an unrelated utility menu.

In this case I would dispense with the whole multiple menu mess, and instead create your menu as normal. In this menu, add a top level hidden item "Utility Menu" and then add all of the utility menu items underneath it. Then make the 3rd call to show_menu2 using that hidden menu item as the root.

i.e. See the sample page at http://code.jellycan.com/sm2test/
These are your menus.
1. Root Level Only
2. Children/Siblings
3. Hidden Menu

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ms on September 07, 2007, 01:26:27 PM
Hi,

I have a difficult question. I want to generate a menue with some graphical elements - different for each level - see here:

(http://www.ogouser.de/menue.jpg)

The black lines show the different (background)  images.

Is it possible and how can I do this with show_menu2?
Any help would be fine.

Thank You an best wishes

Mathias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on September 08, 2007, 04:00:00 AM
Yes. Learn HTML and CSS and go for your life.

First create it yourself in straight HTML. Once you know how to do it,
you then automate it with a menu function like SM2.
See the documentation for what CSS classes SM2 creates.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: spida on September 13, 2007, 02:41:11 PM
If I understand you correctly, you want to have
1) root level menu
2) child menu
3) an unrelated utility menu.

In this case I would dispense with the whole multiple menu mess, and instead create your menu as normal. In this menu, add a top level hidden item "Utility Menu" and then add all of the utility menu items underneath it. Then make the 3rd call to show_menu2 using that hidden menu item as the root.

i.e. See the sample page at http://code.jellycan.com/sm2test/
These are your menus.
1. Root Level Only
2. Children/Siblings
3. Hidden Menu

B


Hi Brofield,

tx for the explanation. I discarted the multiple menu stuff and now have simply three calls for show_menu2 in the code, just as you suggested.
I actually didn't need to change the calls for the main navigation and the menu with its children. The only thing I still don't understand (despite reading your documentation a couple of times) are the variables you use for the hidden menu:
show_menu2(0, 19, SM2_ALL, SM2_ALL), e.g. what is the 19 referreing to?

This menu is still not displayed, thus I would like to understand how the script works to get it work. :-)

Thank you in advance for some further assistance,
regards,
Ayshe
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on September 14, 2007, 03:30:08 AM
It is the page ID for the parent item. Note that this item will not be displayed, only it's children will. You get this number by logging into the admin, clicking on the page that you want to be the parent as though you are going to edit it, and then reading the number out of the address bar.

e.g.
Login
Pages
click page you want as parent
address bar =
http://code.jellycan.com/sm2test/admin/pages/modify.php?page_id=19
The page_id is 19
put this into the show_menu2 call as the parent.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: spida on September 19, 2007, 08:44:24 AM
Thank you, Brofield. You rock!  :mrgreen:
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: deeve007 on October 03, 2007, 09:29:35 PM
This menu won't show normally because of the invisible parent. However, you can show it in your template where-ever you want by specifying the ID of the invisible parent:
<?php show_menu2(1, **INVISIBLE_PAGE_ID**, SM2_ALL, SM2_ALL); ?>

Okay, got my utility menu displaying great with this code. Now my issue is with the breadcrumbs, which show the "hidden" parent page of the utility pages.

I'm using show_breadcrumbs() to display the breadcrumbs. Is there any way to have the breadcrumbs show a link to the Homepage followed by the name of the current utility page, but NOT show the hidden utility parent?

Thanks
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on October 04, 2007, 01:14:03 AM
Use show_menu2 to show the breadcrumbs.  Add a link to the top menu manually.
See http://code.jellycan.com/sm2test/pages/oompa.php which is a page of a hidden
utility menu. Then look for "breadcrumbs". Copy and modify the code as necessary.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: deeve007 on October 04, 2007, 10:59:49 AM
The breadcrumb code wouldn't show anything. I have show_menu2() working fine, but when using the following code absolutely nothing is displayed:

show_menu2(0, SM2_ROOT, SM2_CURR, SM2_CRUMB, '<span class="[class]"> > [a][menu_title]</a>', '</span>', '', '', '<b>You are here:</b> <span class="[class]">[a][menu_title]</a>');

Anyway, have decided to use echo PAGE_TITLE, very simple, to show where I am.

Next issue: I can't see anywhere that shows it possible to assign a class to each individual menu item, in case you want to use an image for each menu item. Easy to assign a class to a menu level, but is it possible to assign for each actual menu item?

And if not, I would suggest this as a fairly important addition to be made.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on October 05, 2007, 01:10:44 AM
Use the page id. i.e. class="page_[page_id] [class]"

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: lanesharon on December 13, 2007, 02:13:50 PM
Brofield,  You might want to remove the references to the udm4 menu, since you are releasing your show_menu2 product as GPL.  udm4, per their website - "is not open-source or public domain software".  Read the rest here:
http://www.udm4.com/licensing/terms/

I have a menu that I use on another website that uses the popout feature.  You may want to look here for it:
http://www.xs4all.nl/~peterned/
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: masarin on March 11, 2008, 05:04:01 PM
I am making my first WB Template and want it to be valid XHTML Strict.

When validating the template I get the error: there is no attribute "target"

The "<?php show_menu2(); ?>" prints the menu items like this:

<ul class="menu-top">
<li class="menu-sibling menu-first">
<a href="http://mysite/wb" target="_top">Hem</a>
</li>
</ul>

Q:
Is there a way to make show_menu2 print the "<a>" tags without the "target=" attribute?
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: doc on March 11, 2008, 05:35:29 PM
Hello,

yes this is possible with the show_menu2 code snippet. Please read the documentation of the developer (http://code.jellycan.com/files/show_menu2-README.txt) which explains what parameters you need to change (section FORMAT STRINGS).

Regards Christian
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: masarin on March 11, 2008, 08:44:40 PM
Tnx.

Uhh, thats hard reading for a non PHP programmer, but I managed to come up with this that's vaidates as XHTML Strict:

Code: [Select]
<?php show_menu2(0SM2_ROOTSM2_CURR+1SM2_PRETTY, &#39;[list][li]<a href="[url]">[menu_title]</a>&#39;); ?>

I then tried to add some other parameters like "SM2_MAX+1" to limit the menu to two levels (root an one sublevel) but then the whole menu disappeared. So I don't really understand the syntax here, it was just luck.

Guess I have to read the documentation a few times more then..
Title: Re: show_menu2: collapsing at second level menu
Post by: kozmoz on March 13, 2008, 12:24:21 PM
We had a little issue with our menu.

When we displayed a page that was at the second level of the menu, suddenly all of its sibling items disappeared. Opening a child at the third level reveals the menu items again.

Now in the sm2_recurse() function I have added an extra check.
This fixed the bug we had, but I'm not sure if it's done right:

in include.php:
Code: [Select]
        else if ($aFlags & SM2_TRIM) {
            // parents and siblings of parents
            // Always show the siblings
            if (!array_key_exists('sm2_is_sibling', $page)
                && !array_key_exists('sm2_on_curr_path', $page)    // not set if false, so existence = true
                && !array_key_exists('sm2_path_sibling', $page)) {  // not set if false, so existence = true
                continue;
            }
        }
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on April 01, 2008, 03:47:57 PM
kozmoz ->
How is your menu different to the test site? The following page is a second level menu with children. I don't see the same problem.
http://code.jellycan.com/sm2test/pages/enterprise/cogs-amp-wheels.php

Not saying that you haven't found a bug. Just clarifying.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on April 10, 2008, 06:35:59 AM
A little cleanup and re-release of Thorn's 4.41 version as 4.5. This has support for WB 2.7 (but maintains support for 2.6.7 still). Source repository is now available at http://code.google.com/p/showmenu2/

See http://code.jellycan.com/show_menu2/ for the download.

Tested with 2.6.7 but not with 2.7
Let me know if there are problems with 2.7
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: doc on April 10, 2008, 07:14:10 AM
Thanks Brofield,

added your new version to the addons repostiory.

Regards Christian
Title: show_menu2 German README available
Post by: doc on April 13, 2008, 09:35:34 AM
Hello,

thanks to BerndJM, we have now a German README file (http://addons.WebsiteBaker.org/media/download_gallery/show_menu2-4.5_README-de.txt) for the show_menu2() code snippet. The German README_DE is included in the lateste code snippet version v4.50 on the Addons repository.

Bernd, thanks for this contribution, pretty sure many people out there will like it  :-)

Regards Christian
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Boudi on April 17, 2008, 09:18:55 AM
Hello,

Recently I noticed a 'bug'? in the show_menu2 function along with the WB search function. When doing a search the menu dissapears. This only happens with multilanguage websites.

Example: go to the HELP page on this WB site and do a search; the vertical menu dissapears after the search. This is the exact problem that I'm facing for the last month when building my own multilanguage website.

See thread: https://forum.WebsiteBaker.org/index.php/topic,9206.msg55182.html#msg55182 (https://forum.WebsiteBaker.org/index.php/topic,9206.msg55182.html#msg55182)

My question is if there are more users who are formiliair with this issue? I already notified sir Brofield regarding this behaviour and hope that he can help me/us in this matter.

Sincerley
Knert
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: doc on April 17, 2008, 10:21:01 AM
Hello,

well it is not really a bug of the show_menu function, it is more the way how WB handles search pages. The page_id is set to zero if you are using the search, therefore the menu disappears with the WB menu functions (show_menu) and the external menu function show_menu2().

Maybe Brofield find out a solution which works without changing WB core files, maybe we need to adapt WB core files, maybe both.

Regards Christian
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Boudi on April 17, 2008, 03:15:59 PM
Hello,

Unfortenately Brofield is momentarily very busy and I respect that off course. So in a short term a solution from him would be difficult what is highly understandable.

So If anyone knows a solution for this issue on a short term or has a good working show_menu2 configuration regarding this issue then would you please share it with us. I would be heavenly greatfull since this topic is bugging me for a month now and I'm keep stretching up the deadline of my client  :|

Sincerly,
Knert

Title: show_menu2 version 4.60 released
Post by: doc on April 22, 2008, 09:11:10 PM
Hello,

just released show_menu2 version 4.60 which includes the page_id = 0 bug fix from Brofield on the addons repository (http://addons.WebsiteBaker.org/pages/modules/code-snippets.php).
If your menu disappears after submitting a search, follow the steps below (requires show_menu2 v4.60 or higher)

Step 1: Add the following input field to the database search settings after
the <form> open tag: WB Backend -> Settings -> Show advanced settings -> Search Settings -> Header
Code: [Select]
<input type="hidden" name="referrer" value="[REFERRER_ID]" />
Step 2: In the index.php of your template, add the following input field immediately following the search <form> open tag.
Code: [Select]
<input type="hidden" name="referrer" value="<?php echo defined(&#39;REFERRER_ID&#39;)?REFERRER_ID:PAGE_ID;?>" />

Brofield thanks for this bugfix.

Regards Christian
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on May 09, 2008, 09:35:55 AM
Hi. I get this error in the scripts.log I have error level set to E_Error which I read is for fatal errors but show_menu2 seems to work great as always. I am setting up new pages so some of the subpages have no content yet which I guess is possible.

Code: [Select]
show_menu2 error: no flags from group 1 supplied! Exactly one flag is required!

I only noticed it because the error file has gotten huge .

Thanks.

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on May 10, 2008, 10:11:27 AM
Read the documentation and check the parameters you are using again. You're not passing the correct flags to the function for the $aFlags parameter.
http://code.jellycan.com/files/show_menu2-README.txt
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on May 11, 2008, 09:05:05 AM
I guess I mucked around with it too much. Since the page still worked I don't even know when I broke it.I went back to one of your examples and left it at that. Works fine now. Thanks.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: BerndJM on June 12, 2008, 03:34:57 AM
Hi Brofield,
just noticed the following:
Code: [Select]
<ul class="menu-top">
    <li class="menu-sibling menu-first">...</li>
    <li class="menu-expand menu-current menu-last">...
     <ul class="">
        <li class="menu-child menu-first menu-last">...</li>
     </ul>
    </li>
</ul>
The class in the child-menu ul is empty.
Bug or feature?

Regards Bernd
Title: Re: show_menu2 version 4.60 released
Post by: avde on June 12, 2008, 05:55:01 PM
Hello,

just released show_menu2 version 4.60 which includes the page_id = 0 bug fix from Brofield on the addons repository (http://addons.WebsiteBaker.org/pages/modules/code-snippets.php).
If your menu disappears after submitting a search, follow the steps below (requires show_menu2 v4.60 or higher)

Step 1: Add the following input field to the database search settings after
the <form> open tag: WB Backend -> Settings -> Show advanced settings -> Search Settings -> Header
Code: [Select]
<input type="hidden" name="referrer" value="[REFERRER_ID]" />
Step 2: In the index.php of your template, add the following input field immediately following the search <form> open tag.
Code: [Select]
<input type="hidden" name="referrer" value="<?php echo defined(&#39;REFERRER_ID&#39;)?REFERRER_ID:PAGE_ID;?>" />

Brofield thanks for this bugfix.

Regards Christian

I can't get this fix to work... I have upgraded the module to 4.6, but under module info it still says 4.5, and the fix is not working... When I use the search, the menu dissapears... What's up with that? Is the right version of show_menu2 on the server?
I have tryed to uninstall the module first, but I get "Cannot uninstall". What should I do?
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on June 13, 2008, 05:13:38 AM
@BerndJM:
Can't say without seeing the parameters for sm2. I suspect a problem with your call. See the doco.
http://code.jellycan.com/files/show_menu2-README.txt

@avde:
Try the main site. The addons repository should just link there anyhow. The info data is 4.6 so if it doesn't show that then you probably have the wrong version installed.
http://code.jellycan.com/show_menu2/
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: avde on June 13, 2008, 12:17:56 PM
@brofield:
yeah I know I have the wrong version, but I can't upgrade to 4.6... If I just install show_menu2-4.6.zip it says upgraded sucessefuly but under module info it remains 4.5... If I try to uninstall the show_menu2 module before upgrading I get "cannot uninstall"...
So what should I do? How can I upgrade the module?
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on June 13, 2008, 12:23:29 PM
Manually install it.

take a copy of the existing modules/show_menu2 directory
delete all of the files
unzip the show_menu2.zip file
copy all of the files into the modules/show_menu2 directory

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: BerndJM on June 13, 2008, 12:42:51 PM
Hi Brofield,

sure the the SM2 call :
Code: [Select]
show_menu2(1, SM2_ROOT, SM2_ALL, SM2_TRIM|SM2_PRETTY); Nothing exotic - did I miss something?

And thanks for the link to the docu - I made the german translation, so I'm quiet sure I read it :lol:

Regards Bernd
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: avde on June 13, 2008, 01:56:45 PM
Manually install it.

take a copy of the existing modules/show_menu2 directory
delete all of the files
unzip the show_menu2.zip file
copy all of the files into the modules/show_menu2 directory

B

Thanks mate! It worked, after manually upolading the new files I only had to reload add-ons with the Admin-Tool and now it shows 4.6 under module info and the menu is shown on the search page! Thanks a lot for the kind support!
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on June 14, 2008, 07:27:53 AM
@bernd
Apologies my friend. Thanks for the German translation. The lack of classes on the ul tag is normal. It has always been this. The list of classes used for the list open is set by the function startList(). The only classes that will ever be used are "menu-top" and if numbered menus are enabled, "menu-N". The list of classes for the items are far more numerous. The documentation doesn't mention this.

Cheers,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on June 16, 2008, 08:03:38 AM
Hi. Can someone help me with a question? I've tried this but not doing it right as when I change I get errors in the log or no data.

This page ...

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

This code works ...

Code: [Select]

echo'<h3>Categories</h3>';
echo'<div style="border-width:0px;">';
show_menu2(0, SM2_CURR+1, SM2_ALL, SM2_ALL|SM2_CURRTREE);
echo'</div>';

I just want to add the description tag...

Code: [Select]
[DESCRIPTION]

can anyone show me the answer?

Thanks very much.

Burt
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: BerndJM on June 16, 2008, 12:46:02 PM
Hi,

to use teh [description] tag you have to set the SM2_ALLINFO flag:

Code: [Select]
show_menu2(0, SM2_CURR+1, SM2_ALL, SM2_ALL|SM2_CURRTREE|SM2_ALLINFO);
Regards Bernd
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: BerndJM on June 16, 2008, 12:48:06 PM
@brofield:
Quote
The lack of classes on the ul tag is normal. It has always been this.
Funny, I never noticed this before ... :roll:

Regards Bernd
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on June 16, 2008, 04:46:42 PM
Thanks!
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on June 17, 2008, 09:00:55 PM
@brofield - a quick idea to consider ....

I note that using show_menu2 sitemap example, and removing everything except [keywords] it is possible to create a 'fake' tag cloud of sorts. I wondered if it might be possible to add a 'tag cloud' format to your show_menu2, with some  css options to vary text size color.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on June 18, 2008, 05:39:31 AM
re: tag cloud
Tag clouds take into account everything in the menu tree, not just the current page. I think this is best left to a specific addin module.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on June 18, 2008, 09:26:36 AM
Thanks brofield.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: rrjbeans on June 22, 2008, 06:00:36 PM
Hello,

I installed wb 2.7 and used css to style drop down menus using show_menu2. Position is set to "absolute" for the submenus so they can popout correctly.

Having one or more period characters in the menu title, and it appears that wb ignores such positioning specified. Remove the periods in the menu title and it returns to normal.

SHOW_MENU2 SETTINGS IN TEMPLATE...
Code: [Select]
<td id="nav"><?php show_menu2(
        
$aMenu          0,
        
$aStart         SM2_ROOT,
        
$aMaxLevel      SM2_ALL,
        
$aFlags         SM2_ALL,
        
$aItemOpen      = &#39;<li class="[menu_title] [class] lev[level]">[a][menu_title]</a>&#39;,
        
$aItemClose     = &#39;</li>&#39;,
        
$aMenuOpen      = &#39;[ul]&#39;,
        
$aMenuClose     = &#39;</ul>&#39;,
        
$aTopItemOpen   false,
        
$aTopMenuOpen   false
        
); ?>
</td>

STYLES.CSS
Code: [Select]
#nav li {
    display: inline;
        position: relative;
}


#nav ul li.lev0 {
        padding-left: 10px;
        padding-right: 10px;
}

#nav li.menu-current {
    background-color: #C0C0C0;
}

#nav li:hover {
        background-color: #C0C0C0;
}

#nav a {
    color: black;
        text-decoration: none;
}

.1 {
    vertical-align: middle;
}

#nav ul li {
    position: relative;
}

#nav ul ul {
    display: none;
        position: absolute;
}

#nav ul ul ul {
    display: none;
        position: absolute;
        left: 100%;
        top: 0;
        width: 100%;
}

#nav ul ul,
#nav ul li:hover ul ul,
#nav ul ul li:hover ul ul
{display: none;}

#nav ul li:hover ul,
#nav ul ul li:hover ul,
#nav ul ul ul li:hover ul
{display: block;}

#nav ul li:hover ul {
    display: block;
        font-size: small;
        /*border: 1px solid black;*/
        background-color: #C0C0C0;
        width: 90px;
        filter: Alpha(Opacity=70, FinishOpacity=75, Style=1, StartX=1, StartY=1, FinishX=20, FinishY=20);
        opacity: 0.7;
        moz-opacity: 0.7;
}

#nav ul ul li:hover ul {
    display: block;
        position: absolute;
        /*left: 600px;
        top: 0;*/
        /*left: 195%;*/
        /*margin-top: -30px;
        margin-right: -100px;*/
        font-size: small;
        /*border: 1px solid black;*/
        background-color: #C0C0C0;
        width: 90px;
        filter: Alpha(Opacity=90, FinishOpacity=95, Style=1, StartX=1, StartY=1, FinishX=20, FinishY=20);
        opacity: 0.9;
        moz-opacity: 0.9;
}

#nav ul li.About:hover ul {
    left: 0px;
        margin-top: 28px;

}


#nav ul li.Studio:hover ul {
    left: 0px;
        margin-top: 28px;

}

#nav ul ul li.Classes:hover ul {
    left: 90px;
        margin-top: 0px;
}

#nav ul ul li.Calendar:hover ul {
    left: 90px;
        margin-top: 0px;
}


#nav ul ul li {
        list-style: none;
        background-image: none;
}

#nav ul ul li:hover {
    background-color: #FFFFFF;
}

#nav ul ul li a {
    border-top: 1px solid #C0C0C0;
        border-bottom: 1px solid #C0C0C0;
        text-indent: -40px;
        text-align: left;
        list-style: none;
        background-image: none;
        display: block;
}

#nav ul ul li a:hover {
    background-color: #FFFFFF;
        border-top: 1px solid #990000;
        border-bottom: 1px solid #990000;
        margin-left: -40px;
        text-indent: 0px;
        display: block;     
        filter: Alpha(Opacity=120, FinishOpacity=125, Style=1, StartX=1, StartY=1, FinishX=20, FinishY=20);
        opacity: 1.2;
        moz-opacity: 1.2;}

#nav ul li.menu-expand {
    background-image: url(http://fladance.org/beta/media/down-arrow-sm.png);
        background-repeat: no-repeat;
        background-position: right;
}

#nav ul ul li.menu-expand {
    background-image: url(http://fladance.org/beta/media/right-arrow.gif);
        background-repeat: no-repeat;
        background-position: right;
}

MENU STRUCTURE:

Home
About
- History
- Staff
- Board
Studio
- Classes
-- one
-- two
-- three
- Calendar
-- Schedule
-- News
- Summer
Gallery
Contact Us

MENU STRUCTURE THAT MESSES MENU POSTIONING UP:

Home
About
- History
- Staff
- Board
Studio
- Classes...
-- one
-- two
-- three
- Calendar...
-- Schedule
-- News
- Summer
Gallery
Contact Us
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: fsuk on July 09, 2008, 06:29:43 PM
will this show private pages?
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on July 09, 2008, 10:45:07 PM
rrjbeans:
you are using the page name as a class. A class cannot have periods in it. Ergo, what happens next is anyone's guess.

fsuk:
if it is supposed to. i.e. the person is logged in and has been given access to that page.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on October 16, 2008, 04:45:41 AM
New version released now. show_menu2 v4.7 adds new functionality. See the readme.en.txt or readme.de.txt files. Note the Extended Options that are now possible. This is the only difference from 4.6 - there is no reason for 99.9% of people to upgrade. See the topic https://forum.WebsiteBaker.org/index.php/topic,11150.html for details of how the new option may be used.

Download from http://code.jellycan.com/show_menu2/

Regards,
Brodie
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on October 20, 2008, 07:03:41 PM
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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on October 21, 2008, 09:30:12 AM
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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on November 10, 2008, 09:29:30 AM
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.

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: vyni on November 10, 2008, 10:41:08 AM
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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on November 10, 2008, 06:35:20 PM
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: vyni on November 10, 2008, 06:51:56 PM
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on November 10, 2008, 08:46:35 PM
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: vyni on November 10, 2008, 09:02:14 PM
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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on November 10, 2008, 10:44:22 PM
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: vyni on November 10, 2008, 10:49:18 PM
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on November 10, 2008, 11:03:03 PM
Thanks again. After trying a few things what seems to work is

Code: [Select]
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

Code: [Select]
<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!
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: vyni on November 10, 2008, 11:08:06 PM
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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on November 10, 2008, 11:12:28 PM
Yes, it works perfect! :)
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Lotus on January 05, 2009, 09:58:35 AM
Got a small problem, pages assigned to $menu[2] only shows if i use $aStart  = SM2_CURR.

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

index.php
Code: [Select]
<?php show_menu2(1,SM2_ROOT+1,SM2_START+); ?>
<?php show_menu2(2SM2_CURR ); ?>

Page layout (The page is multilingual)
Code: [Select]
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on January 05, 2009, 10:01:52 AM
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Lotus on January 05, 2009, 10:38:17 AM
Thanx for your answer brofield, but i could´t get it to work.
Tried the obvius and several other..
Code: [Select]
<?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..
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on January 05, 2009, 10:44:38 AM
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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Lotus on January 05, 2009, 10:51:37 AM
I successfully managed to get the behaviour i wanted by specifying page_id as root:
Code: [Select]
<?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..
..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)?
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on January 05, 2009, 10:57:23 AM
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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Lotus on January 05, 2009, 11:35:01 AM
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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Lotus on January 05, 2009, 11:42:26 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.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: simmy2000 on January 25, 2009, 11:00:07 AM
hi..one question:
i need to add a symbol (like ">" or "-") before every voices of my menu.

the code is this:
Code: [Select]
      <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!
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on January 25, 2009, 11:05:38 AM
Hello,

please read here:

http://code.jellycan.com/sm2test/ (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
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: simmy2000 on January 25, 2009, 11:15:52 AM
thanks for your answer.. i was tried this example

Code: [Select]
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!
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: BerndJM on January 25, 2009, 04:18:48 PM
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
Code: [Select]
show_menu2(0, SM2_ROOT, SM2_START, SM2_ALL, ' | [a][menu_title]</a>', '', '', '', '[a][menu_title]</a>', '');
Regards Bernd
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: luckyfish on February 02, 2009, 10:55:49 PM

Is there a way to display specific root-level pages -and their child pages - and nothing else? For example, say I just want to show the "forum" link above - and no other pages. (The navigation for the site I'm developing is very erratic/inconsistent - so I figured I'd style each nav item individually)

I thought this could be accomplished by putting specific page_ids as the $aStart value. 
 <?php show_menu2(1, 4, 0, SM2_TRIM); ?>
 
But that doesn't seem to work. I searched the forum but couldn't find anything on this specifically.

Any ideas would be very much appreciated.

Thanks, matt

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: BerndJM on February 03, 2009, 12:35:47 AM
Hi,

using the page_id as $aStart should work fine, but - as far as I know - you can't use a numeric value for $aMaxLevel. It should be one of the following:
SM2_ALL - SM2_CURR (+N) - SM2_START (+N) - SM2_START (+N)

Regards Bernd
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: luckyfish on February 03, 2009, 01:57:29 AM

Thanks Bernd - I think I have the syntax correct now.

<?php show_menu2(1, 4, SM2_ALL, SM2_TRIM); ?>

But the only output I can get to display are the children of a specific page (4) - not page_id 4 itself. Is there a way to do that?

Thanks - matt
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: BerndJM on February 03, 2009, 03:21:18 AM
oh, I see the "problem"
but the manual say at this point:

page_id     Display using the specific page as the parent. All
                    child menus of that page will be displayed
.

I have no idea at the moment :|
Maybe you could send a PM to the developer of SM2 ...

Regards Bernd
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Peter R on February 20, 2009, 08:15:48 PM
Hello,

I am experiencing something weird problems with show_menu2, and I have no ideas left.
I want to have my menu look like this:
Home | part1 | part2 | part3
For this, I used:
<?php show_menu2(1, SM2_ROOT, SM2_START, SM2_ALL, ' | [a][menu_title]</a>', '', '', '', '[a][menu_title]</a>'); ?>
Just right out of the textbook.
On the site, everything is under eachother?!?
If I look to the HTML, I have I would say it looks oke? If I put the HTML in frontpage, in design mode it is also oke. In preview mode, it is wrong?!?

What am I doing wrong?
You can find it her: www.tintles. nl

Have fun, like i did...
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: BerndJM on February 20, 2009, 09:11:16 PM
Hi,

it's 'cause you format the .menu a:link, .menu a:visited, .menu a:active  with display: block in your screen.css

Regards Bernd
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Peter R on February 20, 2009, 09:42:18 PM
Thanks for the fast response.
I have no idea what the block was doing there. It was in the template I started with.
To be honnest, I don't even knew block excised.

Got it working now.
Thank again!
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: hexa86 on March 08, 2009, 11:33:36 PM
Hi guys, hi community,

I really appreciate your work on show_menu2, and I just use it while creating a website with website baker but I have one simple question:

I just read your documentation about it, but I was wondering if/how it is possible to address every single generated menu entry for itself. Sorry, if you don't understood me, but English is a foreign language for me :(

Why do I need this? I just want to give every entry a different color with CSS. But I have no clue how to adress the generated entries.

I use the template called "module_finder" and that's my relevant code snippet out of it:

Code: [Select]
<div id="nav">
            <?php show_menu2(0SM2_ROOTSM2_ALL, ( SM2_ALL SM2_NUMCLASS), &#39;<li><a href="[url]" class="[class] navlev[level]">[menu_title]</a>&#39;, "</li>", &#39;<ul class="ullev[level]">&#39;, "</ul>", true, &#39;<ul id="header_menu" class="menu">&#39;);
            //show_menu2(0, SM2_ROOT, SM2_ALL, ( SM2_ALL | SM2_NUMCLASS), false, "\n</li>", false, false, false, &#39;<ul id="header_menu" class="menu">&#39;); 
?>
<br style="clear:left;"/>
        </div><!-- end nav -->

at the moment I only adress all generated entries with #nav in my external css-file, because I do not know how to adress them seperately.

I'd really appreciate your help, and I hope you can tell me whether this is possible or if it is possible a different way. Thank you in advance!

greets
christoph
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 09, 2009, 03:34:30 AM
I just added this entry to the FAQ. Does that help you?

http://code.jellycan.com/files/show_menu2-README.txt
Q:  How do I use a different class/picture/color/widget for each entry in a menu?

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: hexa86 on March 09, 2009, 11:19:10 AM
Thanks for your really fast reply. That's real SUPPORT, man. I just took a short look at it, but after work I will check it out in detail, it really looks the way I can use it however.

You made my day.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: WebBird on March 30, 2009, 04:47:44 PM
Hi,

show_menu2 is great, but not very easy to use. So, I thought about something like a backend, or even a "code generator". You may think of it as a "Wizard" where you make some choices an get the correct SM2 code to use.

Would that be something of interest?
@brofield: Would you be interested in helping me doing this? :-D I would do the "backend" or "generator", but I'm sure I need help in some cases. :roll:
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: virgil on March 30, 2009, 05:07:42 PM
... show_menu2 is great, but not very easy to use. So, I thought about something like a backend, or even a "code generator". You may think of it as a "Wizard" where you make some choices an get the correct SM2 code to use.
Would that be something of interest?

oh yes yes yes, please!  :roll:

so long
virgil
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on March 31, 2009, 03:03:26 AM
I'm not interested but knock yourself out. That is what I built the demo site for.
http://code.jellycan.com/sm2test/pages/time/procrastination.php
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: WebBird on March 31, 2009, 09:47:25 AM
I know that site, but I hear very often that people have problems using show_menu2 all the same. (Me, too, though I'm a developer. I took some answers from the module's code, but most people can't do that.)
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Xagone on April 02, 2009, 02:23:27 AM
i've search and cant fond that ...

how can i identify my base root parent ?

i've got 2 languages

in hierarchy

french
-home
-stuff
-- substuff
english
-home
-stuff
-- substuff

how can i do something like "if this menu is my base parent, do not show it" so that when in french, only english shows, and in english only french shows... ?

right now I use :
Code: [Select]
show_menu2(2, SM2_ROOT, SM2_START, SM2_ALL,'<a href="[url]" target="[target]" class="home">[menu_title]','</a>','','');
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: BerndJM on April 02, 2009, 04:21:18 AM
hi Espace,

at a first hint:
your root is french / english that you wont to display
so your startlevel is SM2_ROOT + 1

Hope I understand your question right ....

Regards Bernd
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Xagone on April 02, 2009, 02:12:20 PM
Nope, doesnt do the trick, thanks for the help.

what i want

when in french, show the menu "english"
when in english, show the menu "french"
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on April 05, 2009, 01:31:26 PM
Easier to just hardcode that sort of menu, but if you really want to do it then show just the top level menu (see "root"). Then add conditional formatting to exclude the current menu item (2).

(1) http://code.jellycan.com/sm2test/#root
(2) http://code.jellycan.com/sm2test/pages/conditional/show-only-siblings.php
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Xagone on April 05, 2009, 02:30:28 PM
thanks brofield... but, already tried and missed.

that's why I asked... i think i'll go with php something like this :

if (page language is french) then {show english menu} else {go with french}
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: vanbemmel on April 06, 2009, 06:04:15 PM
Hi, i use showmenu2 on a site where i display only subitems with this tag:

<?php
show_menu2(
    $aMenu          = 0,
    $aStart         = SM2_ROOT+1,
    $aMaxLevel      = SM2_CURR+1,
    $aOptions       = SM2_TRIM,
    $aItemOpen      = '<a href="[url]" target="[target]" [if(level==1){ class="nav"}][if(level==2){ class="sub"}]>[if(level==2){- }][menu_title]</a>',
    $aItemClose     = '',
    $aMenuOpen      = '',
    $aMenuClose     = '',
    $aTopItemOpen   = false,
    $aTopMenuOpen   = false
    )
?>           

But when you're on a hidden page the subitems of that page are not displayed in the menu either.
When i change the current page to "not hidden" the submenu's are displayed well.\

Is it possible to change this code so submenu's are also displayed on hidden pages ?

Thank you.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: crnogorac081 on April 06, 2009, 06:11:47 PM
 I am not a coder, but based on my experience with WB, SM2 can not see hidden pages, if they are shown in menu, then they are not hidden, right :)))) and if SM2 can not see them, it can not create submenu :P correct me if i m wrong :)
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on April 07, 2009, 02:27:35 AM
http://code.jellycan.com/sm2test/pages/parent/hidden-kids.php#currchild
This page is a hidden page that has children. Those children are shown correctly, see the test "currchild".

I guess the problem is you use of SM2_ROOT + 1 as the start. SM2 won't traverse through the hidden page to show the children. It doesn't even store information about hidden pages at the moment. It could be fixed to do so, but don't hold you breath waiting.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on April 08, 2009, 10:07:04 AM
Ok. I take that back, it is a bug. Fixed in version 4.8.
Download at http://code.jellycan.com/show_menu2/

See output with the following hidden pages:
http://code.jellycan.com/sm2test/pages/parent/hidden-nokids.php
http://code.jellycan.com/sm2test/pages/parent/hidden-kids.php
http://code.jellycan.com/sm2test/pages/parent/hidden-kids/child2.php

Cheers,
B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: scottm52 on May 06, 2009, 10:04:11 PM
Having a coding quandry...  Have used show_menu2 with alot of sites.  But this time a customer haded over a template that is very convoluded and complex.  And the css is damned near unreadable.

But, I have show_menu2 doing it.  Cool.  With a noted exception..  not so cool, and hence the question.

They're governing the highlighting of athe current page with a unique page id  Which I can discover programmatically with SM2 pretty easily.

Code: [Select]
<?php show_menu2(0SM2_ROOTSM2_ALL, &#39;<li>[a] [if(id=current){id="current_tab"}] [menu_title] [/a]</li>&#39;); ?>
Now if you look close that call just won't work.  But how would I set a hard id with an evaluation like this?

THX
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: scottm52 on May 07, 2009, 03:21:51 AM
Having a coding quandry...  Have used show_menu2 with alot of sites.  But this time a customer haded over a template that is very convoluded and complex.  And the css is damned near unreadable.

When in doubt..  change the code...  I went with the more sturctured call and it made it tons easier to debug...

<?php show_menu2(
    $aMenu          = 0,
    $aStart         = SM2_ROOT,
    $aMaxLevel      = SM2_ALL,
    $aOptions       = SM2_TRIM,
    $aItemOpen      = '<li><a href="[url]" id="[if(id==current){updates_tab}]"> [menu_title] [/a]',
    $aItemClose     = '</li>',
    $aMenuOpen      = '<ul id="tabMenu">',
    $aMenuClose     = '</ul>',
    $aTopItemOpen   = false,
    $aTopMenuOpen   = false
    )
?>

Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Stefek on June 11, 2009, 08:52:27 PM
Dear Brofield.

I just updated the show_menu2 on one of my Websites and had to downgrade again.
It has to do with the "bugfix" described on your Homepage:

Quote from: http://code.jellycan.com/show_menu2/
History
4.8 (8 Apr 2009)
Fixed output of menu when a hidden page is the current or parent page.
While this was declared as a Bug, I used it as a Feature - several times.

My question regards to a kind of fallback, if one still wants to "hide" all pages which are marked as "hidden" in the backend.
Is there a parameter for the $aOptions-Call I may use to achieve this?

I still want to use this as a Feature where this is appropriate to my design needs.

Kind regards,
Stefek
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on June 12, 2009, 02:11:36 AM
Hi Stefek,

The fix that I put in should be what most people are after.

The menu item "Parent" that you can see in the full menu here:
http://code.jellycan.com/sm2test/pages/parent.php#full

Has a number of hidden children that can only been seen if you are displaying the hidden page.
http://code.jellycan.com/sm2test/pages/parent/hidden-kids.php#full

This is usually done via a reference to that page id directly, using it as the root.
http://code.jellycan.com/sm2test/#hidden

Would you describe what your problem is for me and how it differs from this usage? Short examples are always good.

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: amitmalka on July 02, 2009, 06:02:24 PM
how i  do like udm but that work ....with the showmenu2
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: vanbemmel on July 23, 2009, 04:46:51 PM
How can I display show_menu2 at a (non WB) php page?

I have a site that consist of WB and normal php pages.
Now I would like to display the WB menu also at those php page dynamically.

Any help would be appreciated.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on July 23, 2009, 04:56:31 PM
I had some non WB php pages I put the menu in previously. In my case I created a page called inserts and then put menus and other dynamic elements  as subpages. I made them hidden and used a blank template

+inserts/
 -menu
 -news

then I used an include statement to call these into the non WB pages.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on July 23, 2009, 05:18:56 PM
I have a minor css issue and wonder if someone sees something obvious. This menu looks good in FireFox and IE7 but in IE8, unless I use compatibility mode, the menu li renders odd - double bullets or the link is below and right of the li. I'm not sure if this is IE8's problem or the structure I have here.

Here's a page that uses this and following is the code

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

Code: [Select]
$options = array('flags' => SM2_TRIM, 'notrim' => 1);

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     = '</li>',
        $aMenuOpen      = '</a></li><ul>',
        $aMenuClose     = '</a></ul>',
        $aTopItemOpen   = false,
        $aTopMenuOpen   = false,
        $options
        );



Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on July 24, 2009, 02:13:23 AM
I can see a few issues.

Your open menu and close menu tags are strange. Put the closing </a> in the item open. Get rid of the </li> from menu close. i.e. menu open = '<ul>' and menuclose is </ul>. Item open is <li> ..., Item close is </li>.

The $options array should replace the $aOptions (was called aFlags) parameter if you are wanting to use it. i.e.
$options = array('flags' =>SM2_ALLINFO|SM2_PRETTY|SM2_TRIM, 'notrim' => 1);
... $aOptions = $options, ....

Try that.
B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: bupaje on July 24, 2009, 03:16:01 AM
Thanks brofield. That's what I needed.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: pixotec on July 28, 2009, 10:02:43 PM
I have defined multiple menues.
menu[3] is the "TopMenu" in two languages.
So I created
EN_TopMenu (Menu Link page) (level 0 in menu[3])
- Contact (level 1 in menu[3])
DE_TopMenu (Menu Link page) (level 0 in menu[3])
- Kontakt (level 1 in menu[3])

This menu is not in the path of the current page (let's say the homepage).
(So any use of SM2_CURR does not work).

I want to show only the TopMenu in the current language (EN -> Contact), so I tried:

Code: [Select]
<?php show_menu2(3SM2_ROOT+1SM2_STARTSM2_ALL, &#39;[li][a][menu_title]</a>[/li]&#39;, &#39;&#39;, &#39;&#39;, &#39;&#39;, false, false); ?>
But I get both language links: Contact and Kontakt.

How to get only the TopMenu of the current language?
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on July 29, 2009, 03:02:18 AM
You can't. Use a single menu tree with hidden branches for your special menus. Then you will be on the path and it will work.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Stefek on August 07, 2009, 06:15:21 PM
@Brofield.

Some Users have had some troubles due to the fact that with the latest version of SM2 the "Hidden Pages" are visible in the menu if active.

User "DarkViper" opened this german discussion to provide a workaround.
https://forum.WebsiteBaker.org/index.php/topic,14772.msg93640.html#msg93640
Most of us are interrested in a inclusion of this workaround to the next SM2 Version.
It was good if this could happen soon, so the Dev Team would integrate those changed version into the WB CMS 2.8 Package.

"DarkViper" has two approaches to handle this.

One needs the $aOptions Parameter "SM2_HIDEPAGES" to work
/show_menu2/include.php
Code: [Select]
044  define('SM2_CURRTREE',  0x0400); // bit 10
045  // Begin MOD by ISTeam, Werner von der Decken, 08.2009
046  define('SM2_HIDEPAGES',    0x0800); // bit 11 (reactivate old behavior and dosn't show hidden pages)

047  // END MOD ---

048  define('_SM2_GROUP_1',  0x000F); // exactly one flag from group 1 is required

.
.
.
574  // mark our current page as being on the current path

575     if ($page['page_id'] == $CURR_PAGE_ID) {

576       $page['sm2_is_curr'] = true;

577       $page['sm2_on_curr_path'] = true;

578  // Begin MOD by ISTeam, Werner von der Decken, 08.2009
579       if (($flags & SM2_HIDEPAGES) == 0){

580          unset($page['sm2_hide']); // don't hide the current page
581      }

582  // END MOD ---
583    }


And the second one needs the $aOptions Parameter "SM2_SHOWHIDDEN"

Code: [Select]
define('SM2_SHOWHIDDEN', 0x0800); // bit 11 (set to show hidden pages)
…     …      
    $page['sm2_is_curr'] = true;
    $page['sm2_on_curr_path'] = true;
    if (($flags & SM2_SHOWHIDDEN) != 0){
        unset($page['sm2_hide']); // don't hide the current page
    }


Please would you consider to include one of this solutions?
Also a small comment by "$aOptions" Parameters here where good afterwards:
http://code.jellycan.com/files/show_menu2-README.txt

I hope you have the time to do this right now (or soon).

Please let us know.

Kind Regards,
Stefek
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 10, 2009, 01:31:50 AM
Hi Stefek,

I have just been sitting on this waiting for someone to come up with a consensus on what they want done.

The original change was based on this person's report:
https://forum.WebsiteBaker.org/index.php/topic,2584.msg82237.html#msg82237

I asked for people's opinion a few times, but didn't get a satisfactory answer as to why it should be one way or another.
https://forum.WebsiteBaker.org/index.php/topic,2584.msg87606.html#msg87606
https://forum.WebsiteBaker.org/index.php/topic,14117.msg89044.html#msg89044

However, on reading that German thread it seems that the following is true:
* hidden pages should always be hidden and not appear in the menu tree
* if "hidden pages" are desired to be shown in the menu tree then they should be private pages

If that is the case, than rather than adding a new option, the current change should be backed out.

Does that seem reasonable?

B
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Stefek on August 10, 2009, 02:51:45 AM
Hello Brofield.

Yes, it sounds reasonable. It makes the code faster, I guess.

I don't really get, what user "vanbemmel" meant and what he was trying to achieve.
This subject is pretty confusing.

What I can see, this user had have more then one menus (different SM2 calls in the template).
One for the parents, and one for the childs.
Let's assume, the parents has been horizontally arranged, the childs verically.
Then, let's assume, one of the parents is "hidden" and you have access to this parent only through the content (a link in the content area linking to that hidden page).
This hidden page has childs and he wants to show them in the vertically arranged menu.
If this is true, I don't get why he didn't get there.
I have a lot of templates arranged like this with hidden pages and it always worked with the "old" show_menu2.

So I understand that a lot of people are confused about this issue.

Regards,
Stefek
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: ruebenwurzel on August 10, 2009, 07:01:53 AM
@brofield

Quote
If that is the case, than rather than adding a new option, the current change should be backed out.

1.) I vote for the handling of hidden pages like in show_menu 4.7
2.) Can you release a Version 4.9 wich works like 4.7 and wich can be added to WB 2.8. But it would be nice to have this tonight, cause we cannot wait longer with relasing the WB 2.8 final.

Thanks
Matthias
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: brofield on August 10, 2009, 08:47:32 AM
4.9 release with default behaviour of 4.7 and using SM2_SHOWHIDDEN to override to get 4.8 behaviour.
http://code.jellycan.com/show_menu2/

It would be nice if you would request changes and releases with more notice in future.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Stefek on October 14, 2009, 10:58:35 PM
Hello,

Just testet version 4.9 but nothing different to 4.8

The Hidden Pages are still visible in the menu as soon as they're aktiv.


 :|

Kind Regards,
Stefek
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: doc on October 15, 2009, 07:59:14 AM
Hi,

Brofield has suspended his support for show_menu2, so maybe the version on his website is not the latest one available. Think WB core team has taken over maintaining for show_menu2 now.

Doc
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: WebBird on October 15, 2009, 10:34:57 AM
Maybe it would be good to close this thread and open a new one for SM2 support.
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Stefek on October 15, 2009, 10:48:18 AM
Hello,
version 4.9 is enclosed in WB 2.8 Final.

But I also used the one from his page - nothing different.

However - I know Brofield made a fantastic Job with this Function. It is so much better that the simple show_menu.
But the latest Change doesn't work properly.

I just used the 'hack' provided by user DarkViper and it works for me.

But there is still a need to implement this behavior into the official SM2 Snippet.

Regards,
Stefek
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: WebBird on October 15, 2009, 11:18:38 AM
Open a bug report.  :wink:

Edit: Here's the thread where brofield hands over show_menu2

https://forum.WebsiteBaker.org/index.php/topic,15050.0.html
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Craxx on May 03, 2010, 03:53:08 PM
Please could somebody help:

The template Multiflex-1 makes this error in cgi_error.log :
show_menu2 error: no flags from group 1 supplied! Exactly one flag is required!

best regards
Craxx;)
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: aldus on May 03, 2010, 05:05:04 PM
This means that one of the following predefined constans are missing at the 4. argument/param
__before__! SM2_PRETTY ...
SM2_ALL
SM2_TRIM
SM2_CRUMB
SM2_SIBLING

So e.g.
Code: [Select]
<?php
show_menu2
(0SM_ROOTSMROOT+1SM2_ALL SM2_PRETTY, ....

will do the trick ...

Kind regards
Aldus
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: mjm4842 on September 15, 2010, 06:22:43 AM
Hi there,

I am using show_menu2 version "4.9 corrected" on WebsiteBaker 2.8.1 in order to prevent hidden menu items from appearing when you are actually on the hidden page. This works great!

The prolem is that child pages which are set to visible of of a page which is set to hidden don't appear in the menu. Allow me to illustrate with an example for those of you who are more visual:

MY HIDDEN SITE (set to hidden)
+-- HOME (set to visible)
+-- ABOUT (set to visible)
+-- CONTACT (set to visible)
YOUR HIDDEN SITE (set to hidden)
+-- HOME (set to visible)
+-- ABOUT (set to visible)
+-- CONTACT (set to visible)

In the above example, MY HIDDEN SITE and YOUR HIDDEN SITE are hidden as per their setting. However, when I access these two pages, HOME, ABOUT and CONTACT are remain hidden, even through they are set to be visible.

What I want is to have these three HOME, ABOUT and CONTACT pages become visible when I am on the hidden MY HIDDEN SITE and YOUR HIDDEN SITE pages.

If you think you can be of help, it would be most appreciated.

With best regards,

Michael
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: Luisehahne on December 21, 2010, 01:43:07 PM
In Add-ons Modules Code snippets you can download show_menu2 Version 4.9.3 (http://www.websitebaker2.org/modules/download_gallery/dlc.php?file=43&id=1292934448l)

Dietmar
Title: Re: show_menu2: valid XHTML and CSS selectable menus
Post by: mjm4842 on December 29, 2010, 04:19:20 PM
Just in case you are are looking for it, Luisehahne's latest version 4.9.5 of Show Menu2 can be found at:

http://www.websitebakers.com/pages/admin/core-replacements/show_menu2.php

From what I can tell, here is a list of the changes:

New $aOptions

SM2_XHTML_STRICT: From all links, created by [a] or [ac], the 'target' - attribute will be removed to preserve the XHTML-Compatibility.

SM2_NO_TITLE: Supress the value of the 'title'-attributes on links which are created by [a] or [ac] formatted links.

New Format Strings

[menu_icon_0]: URL poining to an image for display normal - status
[menu_icon_1]: URL poining to an image for display active/hover - status
[page_icon]: URL poining to an image relating to the current page

New Conditional Formatting Operand

target: Test against the target attribute (on left) or a string containing a possible target (on right)

I could not find a list of changes so if you notice any other changes, please share with the rest of us.

Michael