Jump to content


[Snippet] ListMenu


  • You cannot reply to this topic
190 replies to this topic

#41 yomemiconmigo

    Etomite Forum Fan

  • Member
  • Pip
  • 68 posts

Posted 16 December 2004 - 11:42 PM

rthrash, on Dec 17 2004, 12:33 AM, said:

How is the code outputting now? And can you copy the code you'd like and it's associated CSS here, too, and I'll see if I can help.

This is the stylesheet:

#tabs {

float:left;

width:100%;

background:#369;

font-size:85%;

line-height:normal;

}

#tabs ul {

margin:0;

padding:10px 10px 0;

list-style:none;

}

#tabs li {

float:left;

background:url("imagenes/2right.gif") no-repeat right top;

margin:0;

padding:0 5px 0 0;

}

#tabs a {

float:left;

display:block;

background:url("imagenes/2left.gif") no-repeat left top;

padding:5px 7px 4px 20px;

text-decoration:none;

font-size: 100%;

font-weight:bold;

color:#9cf;

}

/* Commented Backslash Hack

hides rule from IE5-Mac \*/

#tabs a {float:none;}

/* End IE5-Mac hack */

#tabs a:hover {

color:#fff;

}

#tabs #current {

background-image:url("imagenes/2right_on.gif");

}

#tabs #current a {

background-image:url("imagenes/2left_on.gif");

color:#333;

padding-bottom:5px;}


An here's the markup (I understand [[ListMenu]] will replace the unordered list (from <ul> to </ul>):

<div id="tabs">
<ul>
<li id="current"><a href="index.htm"
title="P&aacute;gina &iacute;ndice"
accesskey="p"><em>P</em>rincipal</a></li>
<li><a href="alumnos.htm" title="P&aacute;gina &iacute;ndice"
accesskey="m"><em>M</em>is alumn@s</a></li>
<li><a href="contacto.htm" title="Informaci&oacute;n de contacto"
accesskey="c"><em>C</em>ontacto</a></li>
</ul>
</div>

#42 Guest_rthrash_*

  • Guests

Posted 17 December 2004 - 12:19 AM

And how does ListMenu currently output the code for you?

#43 yomemiconmigo

    Etomite Forum Fan

  • Member
  • Pip
  • 68 posts

Posted 17 December 2004 - 12:30 AM

rthrash, on Dec 17 2004, 01:19 AM, said:

And how does ListMenu currently output the code for you?

It's not the same menu items I listed above, but this is the current output:
<div id="LM_level_">
<ul id="LM_level_1">
<li class="LM_endPage"><a href="mapa.htm" title="Mapa de esta web">Mapa de esta web</a></li>
<li class="LM_endPage"><a href="emailform.htm" title="emailformtrial">emailformtrial</a></li>
<li class="LM_endPage"><a href="39.htm" title="megaprueba">megaprueba</a></li>
<li class="LM_endPage"><span id="LM_youAreHere">tabs</span></li>
<li class="LM_endPage"><a href="principal.htm" title="Página principal">Página principal</a></li>
<li class="LM_collapsed"><a href="profes_creativos.htm" title="Profes creativ@s">Profes creativ@s</a></li>
</ul>

...which is starting to make sense, of course. I guess I must apply those names (LM_endPage, LM_level_1, etc) to my <menu id> and classes. Thanks for your help. You might think you haven't, but it was kind of Socrates's mayeutics, guiding me to draw my own conclusions :D

#44 Guest_rthrash_*

  • Guests

Posted 17 December 2004 - 12:53 AM

A quick start will be to replace "#tabs" with "#LM_level_" in your stylesheet and leave the rest alone. I *think* that will work.

That then leaves the #current selector. That can be handled within the ListMenu Script itself too, if memory serves me correct, with one of the configuration flags.

#45 jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 17 December 2004 - 02:14 AM

yomemiconmigo, on Dec 16 2004, 07:30 PM, said:

<div id="LM_level_">
<ul id="LM_level_1">
<li class="LM_endPage"><a href="mapa.htm" title="Mapa de esta web">Mapa de esta web</a></li>
<li class="LM_endPage"><a href="emailform.htm" title="emailformtrial">emailformtrial</a></li>
<li class="LM_endPage"><a href="39.htm" title="megaprueba">megaprueba</a></li>
<li class="LM_endPage"><span id="LM_youAreHere">tabs</span></li>
<li class="LM_endPage"><a href="principal.htm" title="Página principal">Página principal</a></li>
<li class="LM_collapsed"><a href="profes_creativos.htm" title="Profes creativ@s">Profes creativ@s</a></li>
</ul>

...which is starting to make sense, of course...
Great, I love self solving problems! Sorry so slow on the response and thanks rthrash for chipping in.

I tend to load my snippets with plenty of classes and id's for styling- but try NOT to include any formatting that isn't vital. Ifigure that way it doesn't lock anyone down to my thoughts on how it should look- which would almost certainly be wrong for your site :D

The <div> you use to contain the snippet can of course have any name you choose. That is not generated in the snippet. From there, you can choose to use or ignore the classes I built in. (Sorry- I include lots of style classes, but NO stylesheet :D - that's up to you!)

If you'd like to see it in use (with a handy link to its own stylesheet) head to:
http://www-mirror.vet.ohio-state.edu/etodemo/index.php?id=1

This is still in list format, but you get the idea. You can see how I used the classes etc.

Quote

That then leaves the #current selector. That can be handled within the ListMenu Script itself too, if memory serves me correct, with one of the configuration flags.
That's right. the $currentAsLink will make all items active links- regardless of whether or not you're on that page.

OK- whew- this whole post typed with one hand (other is holding a baby)- makes me appreciate the ability to type! :betterwink:

#46 Guest_rthrash_*

  • Guests

Posted 17 December 2004 - 02:43 AM

Speaking of babies... Carter decided to start walking this week! :D

It's about to get really interesting around the Thrash household...

#47 Guest_marciux_*

  • Guests

Posted 17 December 2004 - 10:17 AM

May be I will better ask you in another way...

Is it possible to use this snippet in order to show the menu starting from the given ID (with all its children) and not the root of the site?

I am using 2 different languages in my site and I want to use ListMenu in the templates showing only the menu structure of one language at a time.

This works in MenuBuilder snippet when using a [[MenuBuilder?id=XX]] tag.

jaredc, on Dec 16 2004, 08:04 PM, said:

Well you'd have to change id's for sure. Can you point me to a URL and show me what's happening, and describe what you WANT to happen instead? Then I should be able to help you better. I have not been able to get it not to work (at least the way I expect it to :D)


#48 jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 17 December 2004 - 12:21 PM

Perhaps I should have made how this snippet works a little more clear in the documentation. It is a very different kind of menu builder.

Most of the menu builders I have seen (and written) start at the root and work down as they build. This one does not. It starts on the page you're on and works it's way BACK to the root. For this reason, it is somewhat tricky to do what you have described. But there are some ways...

The $levelsDeep parameter (which can be set in the snippet or in the snippet call) can be used to cut off the very topmost level. For instance, say you have a menu like:


So you obviously don't want your two main options on every page to French and Italian, you just want Products and Services (in the right language). You could have a start page template where they choose the language, then a template with ListMenu on it with the $levelsDeep parameter set to -1. This will include all menu options except the first from the root end (which in our case is French and Italian). Setting this variable for a positive number counts how many levels from the children of the current page back toward the root to include. 0 indicates all levels. Negative numbers will indicate how many levels NOT to include starting at the root.

[quote}Is it possible to use this snippet in order to show the menu starting from the given ID (with all its children) and not the root of the site?[/quote]

I hope the above has clarified this question. If you are looking for just ONE level of children, then the MenuBuilder snippet is probably a better solution. If you are looking at arbitrary depth, then ListMenu might be a good option as well.

Another option (that would be very similar to using MenuBuilder but allows arbitrary depth), would be to use [url="http://www.etomite.com/browsesnippets.html?int_snipid=10&lst_category=2"]ListSiteMap[/url] and define the root of it. It will start at whatever document you want and work it's way down in a more traditional way. There is currently no way to limit how many levels of depth it will give you, so this could become somewhat unruly. However, if there were a need for a levels setting, you could request it over on that support forum and you just might get it :D

#49 Guest_rthrash_*

  • Guests

Posted 17 December 2004 - 03:29 PM

Quote

Another option (that would be very similar to using MenuBuilder but allows arbitrary depth), would be to use ListSiteMap and define the root of it. It will start at whatever document you want and work it's way down in a more traditional way. There is currently no way to limit how many levels of depth it will give you, so this could become somewhat unruly. However, if there were a need for a levels setting, you could request it over on that support forum and you just might get it
I used the modified version listed in the ListSiteMap thread for just that very purpose on a site recently, and it works quite well. A levels setting would be pretty cool. Consider it requested! ;)

#50 Guest_rthrash_*

  • Guests

Posted 17 December 2004 - 03:37 PM

Quote

ListMenu starts from the page you're on and works it's way BACK to the root, unlike most menu systems which start at a specified page and work their way down. The $levelsDeep parameter determines how far back to work. Negative numbers will indicate how many levels NOT to include starting at the root. For example a template with ListMenu on it with the $levelsDeep parameter set to -1 will include all menu options except the first from the root end. Setting this variable for a positive number counts how many levels from the children of the current page back toward the root to include. 0 indicates all levels.

A modification of this would make great instructions to add to the comments of the snippet file, or in the snippet description itself in the snippet library.

#51 yomemiconmigo

    Etomite Forum Fan

  • Member
  • Pip
  • 68 posts

Posted 08 January 2005 - 04:47 PM

Is there a way to make ListMenu show the long title or description information when the corresponding menu item is hovered? As it is now, the menu link and the information it displays when hovered are exactly the same, which is not very useful. Other than that, I find ListMenu a wonderful tool. :)

#52 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 08 January 2005 - 05:03 PM

yomemiconmigo, on Jan 8 2005, 12:47 PM, said:

Is there a way to make ListMenu show the long title or description information when the corresponding menu item is hovered? As it is now, the menu link and the information it displays when hovered are exactly the same, which is not very useful. Other than that, I find ListMenu a wonderful tool.  :)
The modifications to do this are relatively simple... Here are the two changes which need to be made... B)

Change:
  $childrenList = $etomite->getActiveChildren($geneology[$geneCount], $sortString, null,'id, pagetitle,  parent, isfolder');

To:
  $childrenList = $etomite->getActiveChildren($geneology[$geneCount], $sortString, null,'id, pagetitle, description, parent, isfolder');

AND

Change:
          $currentLevelList .= '<a href="[~'.$childItem['id'].'~]" title="' . $childItem['pagetitle'].'">';

To:
          $currentLevelList .= '<a href="[~'.$childItem['id'].'~]" title="' . $childItem['description'].'">';

If you wanted to use longtitle instead of description you would simply make the appropriate replacements in the modified code... :eto:

#53 yomemiconmigo

    Etomite Forum Fan

  • Member
  • Pip
  • 68 posts

Posted 08 January 2005 - 06:47 PM

Thanks so much! Now it's the perfect menu tool for me. :)

#54 Xandur

    Etomite Forum Newbie

  • Member
  • 11 posts

Posted 21 January 2005 - 10:09 PM

I love the script. After about a week of grueling work trying to learn/implement the CSS tags to get it to work, and after a couple very close mental breakdowns I think I got it working smoothly.

One question though... is there a way to make it so that the entire hierarchy stays intact when clicking on a second layer link. (man, that even confuses me lol).

For example... when going to this link, clicky, posted above by jaredc, when navigating to snippets that directory contains Breadcrumbs, List Indexer, Email Links, etc. But when clicking on List Indexer to view it's contents, all the other links in the snippets directory dissapear. Is there any way to keep those visible?

Thanks!

#55 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 21 January 2005 - 11:00 PM

Xandur, on Jan 21 2005, 06:09 PM, said:

I love the script.  After about a week of grueling work trying to learn/implement the CSS tags to get it to work, and after a couple very close mental breakdowns I think I got it working smoothly.

One question though... is there a way to make it so that the entire hierarchy stays intact when clicking on a second layer link. (man, that even confuses me lol).

For example...  when going to this link, clicky, posted above by jaredc, when navigating to snippets that directory contains Breadcrumbs, List Indexer, Email Links, etc.  But when clicking on List Indexer to view it's contents, all the other links in the snippets directory dissapear.  Is there any way to keep those visible?

Thanks!
Just to clarify things, you want the menu to not collapse, essentially always displaying the entire document tree... Is this what you are looking to achieve...:?:

#56 jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 21 January 2005 - 11:01 PM

Have you tried setting $directGeneology=false ? I'd give that a shot and see if that gets you closer to where you want to be.

#57 Xandur

    Etomite Forum Newbie

  • Member
  • 11 posts

Posted 22 January 2005 - 01:06 AM

That did the trick! Guess I should've read those settings. :D

Thanks alot!

#58 Oreb

    Etomite Forum Newbie

  • Member
  • 34 posts

Posted 26 January 2005 - 08:44 PM

I just wanted to say thanks for a neat snippet. Works fine 'out of the box' - see http://www.mainefocus.com/ - where there used to be run-on menu, now they're 'behaving' just fine.

Thanks! :)

O.

#59 teek5449

    Etomite Forum Newbie

  • Member
  • 3 posts

Posted 30 January 2005 - 05:53 PM

I heve added to this snippet and would like to share. All credit needs to go to the original author jaredc. This script was also already slighlty modified by rad14701 when I picked it up.

I added;
The ability to specify the css selector names used in the menu.
The ability to choose what if any images are shown in the menu.
The option to choose what is displayed on mouse hover, either
the description or title.

While all the are easily changed for people with some understanding of php or general coding I am trying to keep in the spirit of Etomite and keep things simple and easy to change.

Attached Files



#60 rcoates

    Etomite Forum Newbie

  • Member
  • 2 posts

Posted 11 February 2005 - 05:57 PM

Could you or someone please tell me how to set this snippet up or my css to get a list of menus's like on the Etomite default installation but that goes 4 - 5 levels deep? I have tried several changes, but when I use ListMenu (including teek 5449'smodified version) I get a list with a yellow "bullet" next to each item and the entire list shifts dramatically to the right.

You can see it here
http://www.candocomm.com/etomite/index.php?id=17

Thanks for any help. I'm at a lost after several hours.

Robert


teek5449, on Jan 30 2005, 12:53 PM, said:

I heve added to this snippet and would like to share. All credit needs to go to the original author jaredc. This script was also already slighlty modified by rad14701 when I picked it up.

I added;
  The ability to specify the css selector names used in the menu.
  The ability to choose what if any images are shown in the menu.
  The option to choose what is displayed on mouse hover, either
    the description or title.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users