Jump to content

Setting a PHP file as a background in external CSS


calrockx

Recommended Posts

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.