By ravinggenius on
Is there any way to add a PHP variable, created with _phptemplate_variables(), to a CSS file (for instance common.css.php)? I have searched the forums and documentation, and I can't seem to find any information on this.
Comments
If there was a way to get
If there was a way to get the current theme's name, I think I could use that instead.
Nope
Do you mean it like this, don't think it's gonna work, anyway you have to give the css file a php extension for this to work.
CSS:
I don't think it's a good idea to use php vars as css values...
That's not exactly what I
That's not exactly what I need to happen. I am using the following functions in (template.php). I am adapting these from a template I am converting.
Essentially these functions create the HTML necessary to have little thumbnails that instantly change the the website background when clicked (with JavaScript). The beauty of this is they grab the backgrounds and optional thumbnails from a special folder inside the main theme. The thumbnails and the main backgound all depend on the CSS background property.
My page.tpl.php has the following line to place the thumbnails:
echo $vl_wallpaper_html;which might look like:
And my common.css.php ends with this little snippet:
which is supposed to look similar to:
but ends up just being
because I cannot use the template.php-defined variable in a CSS file.
I can place both variables ($vl_wallpaper_css and $vl_wallpaper_html) in page.tpl.php, so I know they both work properly. The only problem I am faced with is adding the CSS to common.css.php instead of placing it in the HTML surrounded by
tags (which works).Hack and Slash
This is a real hack and slash way to do it but....
or something like that. It's probably not a GOOD idea to do, but it'll do the job.
Mike
Thanks for your help, but
Thanks for your help, but that's actually not quite what I have in mind. Please see my last post for more information.