WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • show_menu2: valid XHTML and CSS selectable menus
  • Print
Pages: 1 2 3 [4] 5 6 ... 13   Go Down

Author Topic: show_menu2: valid XHTML and CSS selectable menus  (Read 265728 times)

brofield

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #75 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
Logged

Offline virgil

  • Posts: 179
  • Gender: Male
  • Carpe diem!
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #76 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:
Logged
Virgil - the pre-baked-stuff baker -   ;-))

Offline virgil

  • Posts: 179
  • Gender: Male
  • Carpe diem!
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #77 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
Logged
Virgil - the pre-baked-stuff baker -   ;-))

succhi

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #78 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]
« Last Edit: May 06, 2006, 05:41:42 PM by succhi »
Logged

Offline virgil

  • Posts: 179
  • Gender: Male
  • Carpe diem!
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #79 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

Logged
Virgil - the pre-baked-stuff baker -   ;-))

succhi

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #80 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
« Last Edit: May 07, 2006, 05:07:29 AM by succhi »
Logged

succhi

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #81 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
Logged

succhi

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #82 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]
Logged

brofield

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #83 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
« Last Edit: May 08, 2006, 08:02:52 AM by brofield »
Logged

Offline virgil

  • Posts: 179
  • Gender: Male
  • Carpe diem!
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #84 on: May 08, 2006, 08:33:38 AM »
Hi Brodie, welcome back

Quote from: brofield on May 08, 2006, 08:00:39 AM

... 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
Logged
Virgil - the pre-baked-stuff baker -   ;-))

brofield

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #85 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
Logged

Offline virgil

  • Posts: 179
  • Gender: Male
  • Carpe diem!
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #86 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


Logged
Virgil - the pre-baked-stuff baker -   ;-))

succhi

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #87 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.
Logged

Offline ruebenwurzel

  • Betatester
  • **
  • Posts: 8544
  • Gender: Male
  • Keep on Rockin
    • Familie Gallas Online
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #88 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
Logged

brofield

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #89 on: May 08, 2006, 09:19:15 AM »
Quote from: succhi on May 08, 2006, 09:02:36 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.

Quote from: virgil on May 08, 2006, 08:48:19 AM
... 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
Logged

brofield

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #90 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
Logged

Offline virgil

  • Posts: 179
  • Gender: Male
  • Carpe diem!
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #91 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
Logged
Virgil - the pre-baked-stuff baker -   ;-))

succhi

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #92 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]
« Last Edit: May 08, 2006, 01:20:56 PM by succhi »
Logged

brofield

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #93 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
Logged

brofield

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #94 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
Logged

brofield

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #95 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
« Last Edit: May 28, 2006, 09:25:35 AM by brofield »
Logged

Offline melissa

  • Posts: 168
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #96 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.

« Last Edit: May 28, 2006, 02:22:33 PM by melissa »
Logged

succhi

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #97 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.
« Last Edit: May 31, 2006, 05:06:07 PM by succhi »
Logged

brofield

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #98 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
Logged

brofield

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #99 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
Logged

  • Print
Pages: 1 2 3 [4] 5 6 ... 13   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • show_menu2: valid XHTML and CSS selectable menus
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2