calrockx Posted September 29, 2008 Share Posted September 29, 2008 I've got a DIV and I want it's background to be variable based on what's clicked on the site. I've got a CSS file that's saved as PHP so I can run some PHP in it. I have this function at the top: <?php function big_pic_image () { if(!$_GET[image]) { echo '/sections/_other/image.php/?width=600&height=450&&image=/sections/'.$_GET[section].'/_cover/cover.jpg'; } else { echo '/sections/_other/image.php/?width=600&height=450&&image=/sections/'.$_GET[section].'/'.$_GET[category].'/'.$_GET[image].''; } } ?> And then lower down in the CSS, I have this #big_pic { float: left; width: 600px; height: 450px; margin: 0 10px 10px 0; text-align: center; vertical-align: middle; background: url('<?php big_pic_image(); ?>') center center;} Everything seems to be working except for the variables being passed to the CSS background property. The way those are set are based on the links througout the site. So it seems the PHP in the CSS file isn't "seeing" the $_GET variables in the URL that are set based on image links in the site. How can I make it so that those variables are set in this CSS? Link to comment https://forums.phpfreaks.com/topic/126209-setting-a-php-file-as-a-background-in-external-css/ Share on other sites More sharing options...
calrockx Posted September 29, 2008 Author Share Posted September 29, 2008 -OR- instead of putting a function in the background property, is there a way I can set the background to a php file, and have all the necessary code for this to work just in that? Link to comment https://forums.phpfreaks.com/topic/126209-setting-a-php-file-as-a-background-in-external-css/#findComment-652652 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.