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 ... 13   Go Down

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

brofield

  • Guest
show_menu2: valid XHTML and CSS selectable menus
« 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.
« Last Edit: October 16, 2008, 06:01:21 PM by brofield »
Logged

Stefan

  • Guest
Re: pure CSS menus
« Reply #1 on: February 20, 2006, 02:44:32 PM »
Sounds perfect! Good stuff!
Logged

brofield

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

Offline Hans

  • Posts: 914
  • Gender: Male
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #3 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
Logged
Hans - Nijmegen - The Netherlands

Stefan

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

brofield

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #5 on: February 21, 2006, 08:36:24 AM »
  • Download the "show_menu2.zip" file attached to the original message
  • Log into the WB admin interface
  • Select "Add-Ons", then "Modules"
  • If you already have a version installed, select "show_menu2" from "Uninstall Module" list and click "Uninstall"
  • Under "Install Module", click browse and select the zip file you downloaded, then click "Install"
  • Start using the show_menu2() function in your template files
Logged

brofield

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

brofield

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

PeterM

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #8 on: February 21, 2006, 09:39:39 AM »
This is really cool stuff, nice work  :mrgreen:
Logged

Offline ruebenwurzel

  • Betatester
  • **
  • Posts: 8544
  • Gender: Male
  • Keep on Rockin
    • Familie Gallas Online
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #9 on: February 21, 2006, 10:34:38 AM »
wooooooow  :-D  :-D  :-D
Logged

PeterM

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #10 on: February 21, 2006, 10:57:39 AM »
Quote from: 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.

1.5?
Logged

brofield

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #11 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.
« Last Edit: February 21, 2006, 11:28:49 AM by brofield »
Logged

Offline virgil

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

brofield

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

brofield

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

Stefan

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #15 on: February 22, 2006, 09:44:13 AM »
Quote from: brofield on February 22, 2006, 02:04:20 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?
Logged

brofield

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

Offline ruebenwurzel

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



Logged

brofield

  • Guest
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #18 on: February 22, 2006, 11:41:01 AM »
Quote from: ruebenwurzel on February 22, 2006, 11:04:47 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.

Quote from: ruebenwurzel on February 22, 2006, 11:04:47 AM
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
Logged

brofield

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

Offline ruebenwurzel

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

  • First Template: for pages with no subpages there is no call for submenu and the content uses the whole width.
  • Second Template: for pages with subpages(first level) i use "<?php show_menu2(1, -1, -1); ?>" wich shows only the first level
  • Third Template: for pages with subsubpages(second level) i use "<?php show_menu2(1, -2, -1); ?>" wich shows only the second level

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

Thanks for the great work

Matthias
Logged

brofield

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

brofield

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

Offline rabsaul

  • Posts: 271
    • http://www.pactumgroup.com
Re: show_menu2: valid XHTML and CSS selectable menus
« Reply #23 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!
Logged

Offline ruebenwurzel

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

  • Print
Pages: [1] 2 3 ... 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