PDA

Click to See Complete Forum and Search --> : css - php


nyc_skater
07-09-2007, 07:53 PM
Howdy, I was thinking, it would be neat to write the css file with a php extension then have variables within to change styles depending on what page is called.

So on the user page, it might have instead of a call to include a style sheet, it would have a page variable to be passed to the php style sheet, once there it can deliver the correct styles.

My problem is I'm not sure exactly how the syntax is written :P

hehe

hewligan
07-09-2007, 08:46 PM
Well, I'm not sure it's really that useful - between being able to call different style sheets from a normal PHP page, and being able to set different classes/IDs, I'm not sure what I'd use it for, but here you go:

http://www.codewalkers.com/c/a/Miscellaneous/Dynamic-CSS-with-PHP/

Drazan
07-10-2007, 05:40 PM
Actually, most CMS/forum systems use something like this.

Basically look at how phpbb is set up. They use admin variables to write to a second css sheet that then takes priority over the original "skin" theme.

Also look at smarty templates if you are not familiar with them. PHPbb is based on smarty templates.

The "use" of this type of thing is end user driven. The end user can then create their own template using an admin panel.

Another option is to create different sets of skins and have the admin panel (or public button) change the skin to choice. This is more readily recognized way to change looks.

Hope that helps.
Jade

nyc_skater
07-10-2007, 06:29 PM
Thanks, those things will help.

My biggest reason for wanting to do this is I want to detect the page that's loaded and over ride styles based on that. I'm sure there's other ways but I thought that would be a neat way to do it.

:)