Link to home
Start Free TrialLog in
Avatar of catonthecouchproductions
catonthecouchproductionsFlag for United States of America

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
<?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;
		
		}
	?>

Open in new window

Avatar of kevin_u
kevin_u
Flag of United States of America image

I'd suggest doing an echo basename($_SERVER['REQUEST_URI']); in order to examine what you actually receive. It may be /registration, or /registration/.
Avatar of catonthecouchproductions

ASKER

I did this:       echo basename($_SERVER['REQUEST_URI']);

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;
                
                }
        ?>

Open in new window

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
ASKER CERTIFIED SOLUTION
Avatar of kevin_u
kevin_u
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.