Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Load different images different page

Posted on 2009-07-15
6
Medium Priority
?
181 Views
Last Modified: 2012-05-07
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

0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 12

Expert Comment

by:kevin_u
ID: 24866610
I'd suggest doing an echo basename($_SERVER['REQUEST_URI']); in order to examine what you actually receive. It may be /registration, or /registration/.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24872327
I did this:       echo basename($_SERVER['REQUEST_URI']);

And it gave me: "registration" no slashes.

Ryan
0
 
LVL 14

Expert Comment

by:profya
ID: 24872375
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

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 24874379
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
0
 
LVL 12

Accepted Solution

by:
kevin_u earned 2000 total points
ID: 24875306
If its doing nothing, it means that the if ($_GET) is failing.  Are there query name/value paires on the request?
0
 
LVL 14

Expert Comment

by:profya
ID: 24885390
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.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question