Oct 07, 2008, 03:03 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Donate to MODx: Donations
Pages: [1]   Go Down
  Print  
Author Topic: Individual ids for list items in dropmenu  (Read 3491 times)
0 Members and 1 Guest are viewing this topic.
anselm1109
Jr. Member
*
Posts: 15



WWW
« on: May 08, 2006, 11:34 AM »

I've been searching for this but can't seem to find anything.

Is there any way to make DropMenu assign individual id's for each list item in its output?

so the first list item's id could simply be listitem-1 and the next listitem-2 etc.

This would make it a lot easier to create style sheets and do some fun scriptaculous effects.
« Last Edit: May 10, 2006, 09:30 AM by rthrash » Logged
sottwell
Documentation Team
*
Posts: 8,142



WWW
« Reply #1 on: May 08, 2006, 11:38 PM »

With a bit of creative hacking, it can be done. You have to set a variable to 0 before the loop, where the code generates the <li... tags add the id="item'.$variable.'... and then increment the variable at the bottom of the loop. Or you can simply use the $child['id'] value to make a unique ID, it depends on what you want to do with it. If there are going to be a lot of them that you want to do something with, and you want to process them in order, the first method would be better, while if you're just going to work with a few, the second would be easier to code, as well as being able to identify the menu item with the document it is pointing to. I used the second method here:

http://www.alandaniel.co.uk/builder.html

I could have used a hard-coded menu for the main four sections, with four DropMenu calls, but this way was more fun.
Logged

sottwell.com has moved to a lovely Solaris 10 server!
Log in username guest, password guestuser.
Templates are now becoming available at http://sottwell.com/templates.html
anselm1109
Jr. Member
*
Posts: 15



WWW
« Reply #2 on: May 09, 2006, 08:28 PM »

Thanks, I didn't think of using the $child['id'] value. That makes a lot of sense. I'm not really working on anything in specific, I'm just playing with the idea of using scriptaculous effects on a dropmenu. That's a lot easier when everything has id's.

Thanks for the tip!
Logged
whitehat
Jr. Member
*
Posts: 29


« Reply #3 on: May 21, 2006, 10:58 AM »

With a bit of creative hacking, it can be done. You have to set a variable to 0 before the loop, where the code generates the <li... tags add the id="item'.$variable.'... and then increment the variable at the bottom of the loop. Or you can simply use the $child['id'] value to make a unique ID, it depends on what you want to do with it. If there are going to be a lot of them that you want to do something with, and you want to process them in order, the first method would be better, while if you're just going to work with a few, the second would be easier to code, as well as being able to identify the menu item with the document it is pointing to. I used the second method here:

http://www.alandaniel.co.uk/builder.html

I could have used a hard-coded menu for the main four sections, with four DropMenu calls, but this way was more fun.

HI again,

I am sending you the template of my site and the css that will be used for the topmenu... I thought this would be more effective in order to explain to me what should I do  Sad... if there should be any javascript involved with this, can you send me a sample 2?

Thanks,
Whitehat

* the_templatecss.zip (1.67 KB - downloaded 237 times.)
« Last Edit: May 21, 2006, 11:03 AM by whitehat » Logged
whitehat
Jr. Member
*
Posts: 29


« Reply #4 on: May 21, 2006, 11:02 AM »

P.S This would be the final thing I need in order to finish this site....
Logged
kickass
Full Member
***
Posts: 159



WWW
« Reply #5 on: May 21, 2006, 01:18 PM »

Hmm, just a thought- if you can set this up so each item has its own ID, then for accessibility can it be set up for accesskeys in a similar manner?

I don't have the talent to do this, but if someone who is capable can do it and post this, it would be a REALLY awesome addition to the modx snippet stable (and REALLY kick some Joomla butt . . . )
Logged

"I'd love to change the world but I can't find the source code . . ."

Custom ModX Templates
sottwell
Documentation Team
*
Posts: 8,142



WWW
« Reply #6 on: May 22, 2006, 12:33 AM »

Already done. (the Search feature is sometimes very useful...)

http://modxcms.com/forums/index.php/topic,3031.0.html
Logged

sottwell.com has moved to a lovely Solaris 10 server!
Log in username guest, password guestuser.
Templates are now becoming available at http://sottwell.com/templates.html
whitehat
Jr. Member
*
Posts: 29


« Reply #7 on: May 22, 2006, 04:53 AM »

Already done. (the Search feature is sometimes very useful...)

http://modxcms.com/forums/index.php/topic,3031.0.html


I think we are just wasting time with these back and forth posts.... I did get the dropmenu hacked by you before thanks to your post 2 days ago... and replaced the old DropMenu and it works fine (It's returning ID's of the Documents).

The reason that I sent you the template and the css in my previous post is that I cant figure it out how to configure the CSS accordingly on inactive hover and active and how to call this css in the div tag of the topmenu and in the menu itself (see below in the code section).
And the second reason is that in the template other than calling:

Code:
    <div id="navcontainer" style="position:absolute; width:752px; height:22px; z-index:2; left: 172px; top: 11px;" class="navcontainer">
[!DropMenu? &menuName=`top` &startDoc=`[*StartDoc*]` &levelLimit=`1` &topnavClass=`navcontainer` &here=`activeLink`!]
</div>

for the Top menu I dont know what to do.

Should there be specified something in the head section that would suggest to the dropmenu to get the pics for those id's.

And finaly CSS
(the css file would it look like this? see the attached file for the details).


Since you have already made this work it would help to actually put a post about the whole process of installation of this issue.. starting from DropMenu, DropMenu Template Calling and css sample ... this way the things would actually be more effective (but of course thats what I think).

Anyway I thank you for your continued support starting with multilingual support and all the rest... you never got tired of helping and I am greatefull for that I just Hope that you can find time to input me with the information that I mentioned in this post....

This would terminate my problems and my site would be finished and ready for publishing with a footer message on it that will say thanks to modx team and especially to Susan.

Cheers,
WhiteHat


* css.zip (0.47 KB - downloaded 239 times.)
Logged
kickass
Full Member
***
Posts: 159



WWW
« Reply #8 on: May 22, 2006, 08:15 AM »

Thanks Susan, though it would have been much easier to see if listed on the Repository Snippet list, which it isn't, at least not on the main list, which is the first place I look for special stuff.
Logged

"I'd love to change the world but I can't find the source code . . ."

Custom ModX Templates
sottwell
Documentation Team
*
Posts: 8,142



WWW
« Reply #9 on: May 22, 2006, 01:43 PM »

@kickass: I don't think they put hacks and modifications in the "repository" section, they are sort of unauthorized, use-at-your-own-risk things.

@whitehat: I don't understand your question. In the example link, the top-level menu item's dropdowns with the unique images are simply styled with a height and width and a background image.

Code:
...
#top ul.topnav li ul{
display:none;
clear:left;
position:absolute;
top:2.1em;
left:0;
width:184px;
height:120px;
border-top:1px solid white;
cursor:default;
}
...
#top ul.topnav li.category1 ul{
background:#ada86e url(menuimages/menu1.jpg) bottom left no-repeat;
}
...


Logged

sottwell.com has moved to a lovely Solaris 10 server!
Log in username guest, password guestuser.
Templates are now becoming available at http://sottwell.com/templates.html
whitehat
Jr. Member
*
Posts: 29


« Reply #10 on: May 22, 2006, 02:14 PM »

@kickass: I don't think they put hacks and modifications in the "repository" section, they are sort of unauthorized, use-at-your-own-risk things.

@whitehat: I don't understand your question. In the example link, the top-level menu item's dropdowns with the unique images are simply styled with a height and width and a background image.

Code:
...
#top ul.topnav li ul{
display:none;
clear:left;
position:absolute;
top:2.1em;
left:0;
width:184px;
height:120px;
border-top:1px solid white;
cursor:default;
}
...
#top ul.topnav li.category1 ul{
background:#ada86e url(menuimages/menu1.jpg) bottom left no-repeat;
}
...




Thanks nevermind I got it solved, in the next few days I will send you the complete templates and modifications made by me so you will see what I ment , Anyway the whole multilingual site is working perfectly thanks mostly to your input...
Thanks allot,
Cheers WhiteHat
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!