calrockx Posted September 30, 2008 Share Posted September 30, 2008 I'm a little stumped here. I have a DIV background set to this: background: url('http://vitanova.charlesrubinoff.com/_other/includes/big_pic_image.php') center center;} And the code in that big_pic_image.php reads: <?php if (!$_GET[image]) { $image = "http://vitanova.charlesrubinoff.com/sections/_other/image.php/?width=600&height=450&image=/sections/$_GET[section]/_cover/cover.jpg"; } else { $image = "http://vitanova.charlesrubinoff.com/sections/'.$_GET[section].'/'.$_GET[category].'/'.$_GET[image].'"; } header("Content-type:image/jpeg"); readfile("$image"); ?> That php file uses some variables to know which image to display. So, for example, if I go to http://vitanova.charlesrubinoff.com/_other/includes/big_pic_image.php?section=residential in a browers, an image shows up. If I leave off that query at the end, nothing. The problem is...if I set that php file along as the DIV background, it doesn't have any queries attached to it, so no image comes up. Is there a way I can set it as the background, and then the big_pic_image.php looks at the browser url to know which values to give the variables? How can I have this script "know" what the user clicked so it will show the appropriate image? Quote Link to comment Share on other sites More sharing options...
sKunKbad Posted September 30, 2008 Share Posted September 30, 2008 use basename($_SERVER['PHP_SELF']) Quote Link to comment Share on other sites More sharing options...
calrockx Posted September 30, 2008 Author Share Posted September 30, 2008 okay, how do I implement that? I tried this, but that didn't do it... <?php basename($_SERVER['PHP_SELF']); if (!$_GET[image]) { $image = "http://vitanova.charlesrubinoff.com/sections/_other/image.php/?width=600&height=450&image=/sections/$_GET[section]/_cover/cover.jpg"; } else { $image = "http://vitanova.charlesrubinoff.com/sections/'.$_GET[section].'/'.$_GET[category].'/'.$_GET[image].'"; } header("Content-type:image/jpeg"); readfile("$image"); ?> just not sure how/where to put that Quote Link to comment Share on other sites More sharing options...
sKunKbad Posted September 30, 2008 Share Posted September 30, 2008 Try putting this on the page: <?php echo basename($_SERVER['PHP_SELF']); ?> and check the output, then you will know how to insert the code where you need it. Quote Link to comment Share on other sites More sharing options...
calrockx Posted September 30, 2008 Author Share Posted September 30, 2008 skunkbad, that echo output the file name, big_pic_image.php and I found that if I add this $query = $_SERVER[QUERY_STRING]; it will return the query string. but that's if i type it in right there, it'll output that particular query. what i need is to have the div background set to http://vitanova.charlesrubinoff.com/_other/includes/big_pic_image.php and then have that php page "see" whatever page the user is on in order to pick up the query from the url and display the correct image accordingly Quote Link to comment Share on other sites More sharing options...
sKunKbad Posted September 30, 2008 Share Posted September 30, 2008 Where is the style located? Inline, external, internal? Quote Link to comment Share on other sites More sharing options...
calrockx Posted September 30, 2008 Author Share Posted September 30, 2008 oops, i should have said that. it's an external css file. i know this can be done inline, and external complicates it, but i know there's gotta be a way. that big_pic_image.php, when referenced by the external css, just needs to talk to the browser and see what link the user clicked i guess, so the if-else statement will know what the query string is Quote Link to comment Share on other sites More sharing options...
calrockx Posted October 1, 2008 Author Share Posted October 1, 2008 hm, i tried putting the php in the css and parsing it as css. nope, no go. the script isn't seeing the url query Quote Link to comment Share on other sites More sharing options...
sKunKbad Posted October 1, 2008 Share Posted October 1, 2008 if you want to parse the css file as php, then you need to make it a php file, and make sure you use the appropriate header Content-Type = text/css. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted October 1, 2008 Share Posted October 1, 2008 And you're not going to be able to see what page a user is on (easily and consistently, at least). Quote Link to comment Share on other sites More sharing options...
discomatt Posted October 1, 2008 Share Posted October 1, 2008 And you're not going to be able to see what page a user is on (easily and consistently, at least). $_SERVER['PHP_SELF'] $_SERVER['REQUEST_URI'] $_SERVER['SCRIPT_NAME'] $_SERVER['SCRIPT_FILENAME'] Quote Link to comment Share on other sites More sharing options...
DarkWater Posted October 1, 2008 Share Posted October 1, 2008 And you're not going to be able to see what page a user is on (easily and consistently, at least). $_SERVER['PHP_SELF'] $_SERVER['REQUEST_URI'] $_SERVER['SCRIPT_NAME'] $_SERVER['SCRIPT_FILENAME'] Yeah, that's great, now figure out what page they're on from an external PHP file that the browser fetches for CSS. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.