[Solved] CSS classes with page childrens' page aliases

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
chillifish
Forum Members
Forum Members
Posts: 92
Joined: Wed Jul 27, 2011 9:26 am

[Solved] CSS classes with page childrens' page aliases

Post 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!
Last edited by chillifish on Fri May 09, 2014 1:46 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: CSS classes with page childrens' page aliases

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: CSS classes with page childrens' page aliases

Post 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.
chillifish
Forum Members
Forum Members
Posts: 92
Joined: Wed Jul 27, 2011 9:26 am

Re: CSS classes with page childrens' page aliases

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: CSS classes with page childrens' page aliases

Post 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.
chillifish
Forum Members
Forum Members
Posts: 92
Joined: Wed Jul 27, 2011 9:26 am

Re: CSS classes with page childrens' page aliases

Post 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!
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: [Solved] CSS classes with page childrens' page aliases

Post by Dr.CSS »

Your UL don't have the starting/opening <li> in them...
Post Reply

Return to “CMSMS Core”