[solved] how to convert an HTML/CSS menu to work in CMSMS

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
jpatti
Forum Members
Forum Members
Posts: 41
Joined: Mon Jun 28, 2010 1:43 am

[solved] how to convert an HTML/CSS menu to work in CMSMS

Post by jpatti »

OK, I have a horizontal menu with 5 items across the top.  It's very simple, got background images, doesn't "light up" when on the active page or on hover, no drop-downs, just a plain vanilla horizontal menu.  However, one link is to an external URL and it needs to have different background images than all the rest.  

I've a screenshot attached taken from the HTML/CSS version I'm trying to turn into a CMSMS template.  Note that Little Black Datebook is NOT a page on the current site, we're not on this page, we're not hovering, none of that.  It's a link to the "sister" site, an external link.  

I've looked at the HTML written by menu.tpl and menu.tpl itself and the description of the parameters it takes, and I'm unsure how to accomplish this, how to tell CMSMS this one item needs an additional class so I can style it differently.  
Attachments
menu.png
Last edited by jpatti on Mon Jul 05, 2010 9:02 pm, edited 1 time in total.
uniqu3

Re: how to convert an HTML/CSS menu to work in CMSMS

Post by uniqu3 »

I don't know how exactly menu.tpl looks like but you could try:

Code: Select all

{if $node->alias !="aliasforexternalpage"}
<a class="extraclasstostyle" 
jpatti
Forum Members
Forum Members
Posts: 41
Joined: Mon Jun 28, 2010 1:43 am

Re: how to convert an HTML/CSS menu to work in CMSMS

Post by jpatti »

Thanks uniq, twice you've been very helpful to me.

It appears I need to go learn smarty...
jpatti
Forum Members
Forum Members
Posts: 41
Joined: Mon Jun 28, 2010 1:43 am

Re: [solved] how to convert an HTML/CSS menu to work in CMSMS

Post by jpatti »

I found a better solution, so decided it should be here for the next person searching for an answer to this.

My solution is better in that it's pure CSS and doesn't involve mucking about with the tpl file, instead just using attribute selectors in the stylesheet.  You just refer to the item you want to give a different background as  a[href='http://specific_url_here'] {styles go here}

I've never played with attribute selectors before.  There's spotty support for the entire specification, but the simple [attribute='value'] is well-supported in all modern browsers plus IE7 and up according to documentation I can find.  That's good enough for me, YMMV.

I've personally tested in IE8, Firefox 3.6.3 and Chrome 5.0.375.99 and all is good.
uniqu3

Re: [solved] how to convert an HTML/CSS menu to work in CMSMS

Post by uniqu3 »

Yes you are right, unfortunately i still have to deal with IE6 support in many cases that's why i prefer an extra class.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: [solved] how to convert an HTML/CSS menu to work in CMSMS

Post by Dr.CSS »

You can import the menu template of your choice and add {$node->alias} to all the li or a href calls then all the menu items will have their page alias as a class then just use that pages alias in your css call...

li.'pagealias' or a.'pagealias' {your style calls}...
Post Reply

Return to “Layout and Design (CSS & HTML)”