Dec 04, 2008, 01:14 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search via SMF or Google: modx forums all of modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: custom class for the dropmenu's <LI>  (Read 2803 times)
0 Members and 1 Guest are viewing this topic.
grunt_lord
Full Member
***
Posts: 202


"Doing the most out of nothing"


WWW
« on: Mar 30, 2006, 01:49 PM »

Hi!

I want to use Lightbox Gone Wild to show my website content, but to do so I would need to have a custom class added to the <li> of the dropmenu.  How can I do it ??

thanks in advance,

Blaise
Logged

Blaise Bernier

www.medialdesign.com - Solutions for small business, hosting, design and more!
rthrash
Foundation
*
Posts: 9,575



WWW
« Reply #1 on: Mar 30, 2006, 09:27 PM »

Hmmm... describe what you want in a feature request and we'll see if it can happen for the next release (bugtracker request that is...)
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
heliotrope
Coding Team
*
Posts: 2,447


WWW
« Reply #2 on: Mar 31, 2006, 02:57 AM »

Hi,

I've made a couple of changes in dropMenu to achieve this.
I've posted the tip in french Forum.

I copy and Paste the way I've realized the hack.

Hope this help.

Create a new TV called -> idCssMenu (text)

Duplicate DropMenu and made these changes

- Added after line 224:

Code:
$myTv =  $modx->getTemplateVar('IdCssMenu',$fields='*',$child['id']);
- line 262 (<p> tags are specifics to my needs)
Code:
($myTv !='' ) ? $idCss = 'id="'.$myTv['value'].'": $idCss ='';               
$output .= "    <li $idCss class=\"$hereClass". ($numChildren == 0 ? ' last' : '')."\">$itm<p>".$child['introtext']."</p></li>$ie";

- and line 297
Code:
<li $idCss $class>$itm$desc</li>$ie";


EDIT: I guess you 'll have to modidfy more lines after 262 because I didn't need to custom sublevel
« Last Edit: Mar 31, 2006, 03:10 AM by heliotrope » Logged

grunt_lord
Full Member
***
Posts: 202


"Doing the most out of nothing"


WWW
« Reply #3 on: Mar 31, 2006, 03:44 PM »

It's not a bad idea! But i was wrong... I needed a class in the link, not the <li>...  Anyway, Scotty Delicious is working on an extended version of the Drop Menu and he is supposed to include that specific feature!
Logged

Blaise Bernier

www.medialdesign.com - Solutions for small business, hosting, design and more!
Dr. Scotty Delicious
Coding Team
*
Posts: 1,172


Dr. of Fine Pirate Arts


WWW
« Reply #4 on: Mar 31, 2006, 07:02 PM »

It's not a bad idea! But i was wrong... I needed a class in the link, not the <li>...  Anyway, Scotty Delicious is working on an extended version of the Drop Menu and he is supposed to include that specific feature!

And....
Revision 0.1 is done.  You can check it out here:

http://modxcms.com/forums/index.php/topic,3724

later

-sD-
scottyDelicious
Logged

We pillage, we plunder, we rifle and loot. Drink up me 'earties, Yo Ho!
We kidnap and ravage and don't give a hoot. Drink up me 'earties, Yo Ho!
Yo Ho, Yo Ho! A pirate's life for me.
heliotrope
Coding Team
*
Posts: 2,447


WWW
« Reply #5 on: Apr 01, 2006, 01:25 AM »

@ grunt_lord
I thought that you wanted to set a different class to each <li> that's why I proposed this hack. :-)
Logged

grunt_lord
Full Member
***
Posts: 202


"Doing the most out of nothing"


WWW
« Reply #6 on: Apr 01, 2006, 02:07 AM »

hehe... at first i thought i wanted to modify the <LI> too Wink
Logged

Blaise Bernier

www.medialdesign.com - Solutions for small business, hosting, design and more!
Dimmy
Testers
*
Posts: 1,824


Я не говорю по-русски 私は日本語を話さない


WWW
« Reply #7 on: Apr 01, 2006, 04:19 AM »

Dit Ryan not give an example a while ago (I searched can not find it any more) to use the &pre and the &post tag to generate a custom style tag for eacht document depending on the id?

somthing like &pre=`<span class=[*id*]>` &post=`</span>` not sure if it was this but it would grab the id number of that menu item so if you would have page 1,2,3,4,5 tbe listed in dropmenu than the class would automaticly be 1,2,3,4,5

but I can not recall it by hart anymore and I can not find the original post.

 
Logged

"They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, because if you play it forwards, it installs Windows."
Nederlands beste portal voor pda en mobiel internet
rthrash
Foundation
*
Posts: 9,575



WWW
« Reply #8 on: Apr 01, 2006, 07:59 AM »

That would actually put in the id of the current document, but that would indeed work. You could also create a unique ID by using the counter in the for loop though.
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
sottwell
Documentation Team
*
Posts: 8,170



WWW
« Reply #9 on: Apr 02, 2006, 06:48 AM »

I've done that when I wanted to have a different background for each main menu item. I simply added an incrementing variable into the MakeMap loop and appended it to the LI class specified in the snippet options when the <li... tag is being generated.

Quote
<ul class="topnav">
<li class="category1">Item One
...submenu
</li>
<li class="category2">Item Two
...submenu
</li>
<li class="category3">Item Three
...submenu
</li>
<li class="last category4">Item Four
...submenu
</li>
</ul>

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
Dimmy
Testers
*
Posts: 1,824


Я не говорю по-русски 私は日本語を話さない


WWW
« Reply #10 on: Apr 03, 2006, 01:44 AM »

I've done that when I wanted to have a different background for each main menu item. I simply added an incrementing variable into the MakeMap loop and appended it to the LI class specified in the snippet options when the <li... tag is being generated.

Quote
<ul class="topnav">
<li class="category1">Item One
...submenu
</li>
<li class="category2">Item Two
...submenu
</li>
<li class="category3">Item Three
...submenu
</li>
<li class="last category4">Item Four
...submenu
</li>
</ul>



could you post the change here and the sntippet call?
Logged

"They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, because if you play it forwards, it installs Windows."
Nederlands beste portal voor pda en mobiel internet
sottwell
Documentation Team
*
Posts: 8,170



WWW
« Reply #11 on: Apr 03, 2006, 07:15 AM »

Depending on the version number your line numbers may vary.
Line 217:
Code:
$categoryNumber = 1; // initialize li class number - sottwell
//loop through and process subchildren
foreach ($children as $child) {
// figure out if it's a containing category folder or not
Line 277:
Code:
// it's an empty folder and using Category Folders
if ($useCategoryFolders && $itsEmpty) {
$class .= ($class ? ' ' : '').$categoryClass.$categoryNumber; // append li number - sottwell
}
and line 298:
Code:
    $class = '';
    $categoryNumber++; // increment li class number - sottwell
    }
  }
$output .= "</ul>$ie";

Snippet call:
Code:
[[DropMenu?startDoc=`49`]]

I only wanted this for empty top-level folders, so that's where I added the number variable. You can see where I used this here. Each top-level li has a different background image. The "category" class is automatically added to empty folders; you can of course change the name in the snippet call with &categoryClass.
« Last Edit: Apr 03, 2006, 07:23 AM by sottwell » 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
Dimmy
Testers
*
Posts: 1,824


Я не говорю по-русски 私は日本語を話さない


WWW
« Reply #12 on: Apr 05, 2006, 06:07 AM »

Nice this is exacly what i need aswhell
Logged

"They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, because if you play it forwards, it installs Windows."
Nederlands beste portal voor pda en mobiel internet
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!