catonthecouchproductions
asked on
Load different images different page
I am using this code below so when the URL is domain.com/registration/ load the following images for my image slideshow and everything else use the other set.
For some reason it is just loading the first image 4.jpg.
Any ideas?
No PHP errors too.
Thanks,
Ryan
For some reason it is just loading the first image 4.jpg.
Any ideas?
No PHP errors too.
Thanks,
Ryan
<?php
if($_GET )switch(basename($_SERVER['REQUEST_URI'])){
case "registration":
echo ' <img src="bloginfo('.template_url.')/images/middle/4.jpg" alt="middle image" width="998" height="177" />
<img src="bloginfo('.template_url.')/images/middle/5.jpg" alt="middle image" width="998" height="177" />
<img src="bloginfo('.template_url.')/images/middle/6.jpg" alt="middle image" width="998" height="177" />';
break;
default:
echo ' <img src="bloginfo('.template_url.')/images/middle/1.jpg" alt="middle image" width="998" height="177" />
<img src="bloginfo('.template_url.')/images/middle/2.jpg" alt="middle image" width="998" height="177" />
<img src="bloginfo('.template_url.')/images/middle/3.jpg" alt="middle image" width="998" height="177" />';
break;
}
?>
I'd suggest doing an echo basename($_SERVER['REQUEST _URI']); in order to examine what you actually receive. It may be /registration, or /registration/.
ASKER
I did this: echo basename($_SERVER['REQUEST _URI']);
And it gave me: "registration" no slashes.
Ryan
And it gave me: "registration" no slashes.
Ryan
Try this:
<?php
if($_GET )switch(preg_match('/registration\/$/', $_SERVER['REQUEST_URI'])){
case 1:
echo ' <img src="bloginfo('.template_url.')/images/middle/4.jpg" alt="middle image" width="998" height="177" />
<img src="bloginfo('.template_url.')/images/middle/5.jpg" alt="middle image" width="998" height="177" />
<img src="bloginfo('.template_url.')/images/middle/6.jpg" alt="middle image" width="998" height="177" />';
break;
default:
echo ' <img src="bloginfo('.template_url.')/images/middle/1.jpg" alt="middle image" width="998" height="177" />
<img src="bloginfo('.template_url.')/images/middle/2.jpg" alt="middle image" width="998" height="177" />
<img src="bloginfo('.template_url.')/images/middle/3.jpg" alt="middle image" width="998" height="177" />';
break;
}
?>
ASKER
Hey, thanks!
This is the source after load:
<div id="middle_image" class="grid_12">
</div>
Using that code above, not sure why its not printing anything out.
Ryan
This is the source after load:
<div id="middle_image" class="grid_12">
</div>
Using that code above, not sure why its not printing anything out.
Ryan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In addition to what said above by kevin_u, may be there is a fatal syntax error, please add this line to the first line of your php script:
error_reporting(E_ALL);
And let's know what's up.
error_reporting(E_ALL);
And let's know what's up.