show_menu2: valid XHTML and CSS selectable menus

mjm4842

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
Frustrated? Spending too much time developing when all you really want is a working website? Contact me directly if I can be of services to you.
___________________________


www.tngconsulting.ca

Luisehahne

Note: Once the code has been generated, it is easy to debug. It's not a bug, it's a feature!

mjm4842

#318
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
Frustrated? Spending too much time developing when all you really want is a working website? Contact me directly if I can be of services to you.
___________________________


www.tngconsulting.ca

aldus

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.

<?php
show_menu2
(0SM_ROOTSMROOT+1SM2_ALL SM2_PRETTY, ....


will do the trick ...

Kind regards
Aldus

Craxx

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;)
Craxx;)

WebBird


Stefek

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
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

WebBird

Maybe it would be good to close this thread and open a new one for SM2 support.

doc

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

Stefek

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
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

brofield

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.

ruebenwurzel

@brofield

QuoteIf 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

Stefek

#308
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
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

brofield

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

Stefek

@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

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"

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
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

brofield

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.

pixotec

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:

<?php show_menu2(3SM2_ROOT+1SM2_STARTSM2_ALL'[li][a][menu_title]</a>[/li]'''''''falsefalse); ?>

But I get both language links: Contact and Kontakt.

How to get only the TopMenu of the current language?

bupaje


brofield

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

bupaje

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


$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
        );





bupaje

#300
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.

vanbemmel

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.

amitmalka

how i  do like udm but that work ....with the showmenu2

brofield

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

Stefek

#296
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
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden