Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Displaying an image based on URL origination-URL Redirect

0 views
Skip to first unread message

ChristoinSD

unread,
Jul 24, 2006, 3:17:25 AM7/24/06
to
I am new to PHP and coding.

I have several domains that use splash pages that point to my main
site:
i.e. http://www.mysite.com/index.php.

How do I replace an image, named "Logo.gif" on the main page
"http://www.mysite.com/index.php" with the image named "logo.gif"
from the URL splashpage, " http://www.mysite.com/SanDiego/"

Both images are named logo.gif because the PHP script references
logo.gif through the script in too many places...It is just easier to
keep the name logo.gif

Problem:
If a user is on the San Diego page and clicks to the main page I want
the user to feel that the site is all about SanDiego.
If a user is on the Los Angeles page and clicks to the main page I want
the user to feel that the site is all about Los Angeles.

Hence the site and database will still be the same..I just want them to
feel the experience is personalized for their city and this will be
determined by changing the logo.gif.

I am using an image named logo.gif that will display SanDiego for the
San Diego page
I am using an image named logo.gif that will display Los Angeles for
the Los Angeles page

I have seen some PHP code that uses php echo $picture I am not sure if
this will work...

Can you please provide the code....This would be greatly appreciated.

Noodle

unread,
Jul 24, 2006, 4:07:19 AM7/24/06
to

Is this what you were thinking of?

<?php
switch ( $_SERVER["SCRIPT_URL"] ):
case '/SanDiego/':
case '/SanDiego/index.php':
$img_url = "path/to/san/logo.gif";
break;
default:
$img_url = "path/to/la/logo.gif";
break;
endswitch;

echo "<img src=\"$img_url\" alt=\"Splash Image\"/>"
?>

0 new messages