show_menu2: valid XHTML and CSS selectable menus

ruebenwurzel

Hello,

Quoteusing 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

gavjof

Hi,

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


// 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

ruebenwurzel


bgg

#167
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


kweitzel

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

berkeweb

Hi Klaus,

thank you for recommending css.maxdesign.com.au 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:



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:

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

kweitzel

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.au 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

berkeweb

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:



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

kweitzel

That sounds like a good update, thanks ... downloded it and will have a look later.

cheers

Klaus

brofield

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


  • Support for greater than equal (>=), less than equal (<=) logic in conditional formatting.
  • Added ability to test against page level and page ID in the conditional formatting.
  • Removed the sm2_ prefix from the legacy functions in legacy.php so that when including this file the standard show_menu and page_menu functions are transparently redefined to use show_menu2.

B

brofield

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

dw2006

thanks for showing the logic of this. Something for me to do over the holidays!   I will feel like a real hacker! ;-)

brofield

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.

dw2006

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:

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! :)

brofield

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)"

dw2006

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:

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

Thanks, greetings, and happy holidays/christmas/chanukkah/kwanzah/festivus etc.!   

brofield

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


  • Support test for not-equals and non-existence of classes in the conditional formatting. i.e. the != operator
  • Support the equals operator as the double-equals (==) that most people are used to (although single equals (=) is still supported for backward compatibility)

B

kweitzel

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:

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

yppds

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

yppds

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.

brofield

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.

kweitzel

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

yppds

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.

kweitzel

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

yppds

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.