Page 1 of 1
[Solved] CSS classes with page childrens' page aliases
Posted: Thu May 08, 2014 4:59 pm
by chillifish
Before I go to far down the path of trying to work out how I might do this, perhaps someone would be able to let me know if it's even possible.
I want the background of each of my menu list items to change depending on it's class, it's class equals it's page alias.
Rather than type in the css individually as it will change when the pages change, is there a way of dynamically writing the css? I'm thinking of something along the lines of:
Code: Select all
for each child of current page class name equals child's page alias
A lot of this hinges on whether or not the child page aliases of a page are available, I haven't found any evidence so far!
Re: CSS classes with page childrens' page aliases
Posted: Thu May 08, 2014 5:27 pm
by calguy1000
You can use a MenuManager template and other smarty magic to generate inline css. but the colors in the css still has to be hardcoded somewhere, unless you're going to be using some kind of mathematics to calculate the color.
Re: CSS classes with page childrens' page aliases
Posted: Thu May 08, 2014 5:34 pm
by velden
Not sure what you want to do exactly.
Menu items are build using Menu Manager I assume?
In Menu Manager help you can find the available properties you can use like $node->alias but also $node->extra1
You could use the 'extra1' property to fill in a color value in 'Extra Page Attribute 1' field in Options tab of content (page).
Want to make it really flexible?
Read this post:
http://www.i-do-this.com/blog/Add-color ... website/57
I recently implemented it so editor can change color of menu/page background.
Re: CSS classes with page childrens' page aliases
Posted: Fri May 09, 2014 8:24 am
by chillifish
The background is an image which has the page alias as it's name. It's for an employee list, see
http://proof.chillifish.com/pgp/index.php?page=people.
I have currently done it in-line with the menu manager template, but was hoping not to have multiple menu templates as I have two already that only have subtle differences, doing it this way would also mean having another html template and menu template for the children of this page.
If there's no way of doing it the way I was thinking, ie, a page's children are not accessible, then I'll just have to do it with two templates.
Re: CSS classes with page childrens' page aliases
Posted: Fri May 09, 2014 9:53 am
by velden
I think I'd use a module for that purpose in stead of Menu Manager and lot of content pages.
Have a look at
ListItExtended (a.k.a Listit2 and LI2)
That said, you need to setup that module too and of course customize templates for your needs.
Re: CSS classes with page childrens' page aliases
Posted: Fri May 09, 2014 1:45 pm
by chillifish
Good thinking, I've used that module in the past, it's funny how you go too far down one path without thinking of easier solutions!
Re: [Solved] CSS classes with page childrens' page aliases
Posted: Tue Jul 01, 2014 4:47 pm
by Dr.CSS
Your UL don't have the starting/opening <li> in them...