Find the last list item dynamically

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
HurricaneDan
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sat Jun 17, 2006 1:22 am

Find the last list item dynamically

Post by HurricaneDan » Wed Nov 07, 2007 2:19 pm

I need to add styling to a menu.  The menu when viewed as source looks something like this:


  menu 1
  menu 2
   
      submenu 1
      submenu 2
   
 
  menu 3


I need to be able to find the last submenu item for any menu and also find the last menu item so I can add a class/id to it to change the styling like this:


  menu 1
  menu 2
   
      submenu 1
      submenu 2
   
 
  menu 3


Here are my styles as they currently exist.

#gutter_left ul li {
  background-color: #00853f;
  border-bottom:1px solid #FFFFFF;
}
#gutter_left ul li ul li {
  background-color: #00853f;
  border-bottom:1px dashed #FFFFFF;
}
#gutter_left .no_border {
  border-bottom: 0;
}

I need to be able to find the number of list items, dynamically, and apply this if at all possible.

I am not sure what mod/com writes the menus.  Any help would be helpful.

Thanks,

Dan

Opie
Joomla! Apprentice
Joomla! Apprentice
Posts: 47
Joined: Thu Jun 22, 2006 7:32 pm
Contact:

Re: Find the last list item dynamically

Post by Opie » Thu Nov 08, 2007 8:08 pm

Which version? 1.5 or 1.0.x?
http://springhillalumni.org • Springhill High School Alumni Association

HurricaneDan
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sat Jun 17, 2006 1:22 am

Re: Find the last list item dynamically

Post by HurricaneDan » Thu Nov 08, 2007 8:25 pm

1.0.13

Thanks,

Dan

Opie
Joomla! Apprentice
Joomla! Apprentice
Posts: 47
Joined: Thu Jun 22, 2006 7:32 pm
Contact:

Re: Find the last list item dynamically

Post by Opie » Fri Nov 09, 2007 8:05 pm

HurricaneDan wrote: 1.0.13

Thanks,

Dan
I'm assuming you are using the stock menu.  You might check this file, /modules/mod_mainmenu.php, as a start.  I'm not certain at this time which line to start looking.  However, I would think if you searched that file for elements you see in your web page source code, you should find the area.

Good luck.
http://springhillalumni.org • Springhill High School Alumni Association


Post Reply