Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the style based on where the user comes from...

Status
Not open for further replies.

kirthijn

Programmer
Apr 10, 2001
5
US
Hi Guys,
I created a community as part of my website....
I have a logo at the top of the community... A user will be directed to the community from two different pages... I was wondering how I can change the logo based on where the user came from...

for example,
if the user comes from i want logo1.gif to be shown

if the user comes from i want logo2.gif to be shown

The community is php based... thanks a lot !
 
Hi,

<?
$from=$http_referer;
echo $from;
?>

based on this value do this:

<?

$from==&quot;the_output_for_comm1&quot;?&quot;<img src='comm1.gif'>&quot;:&quot;<img src='comm1.gif'>&quot;;

?>

Rick
 
Hi,

<?
$from=$http_referer;
echo $from;
?>

based on this value do this:

<?

$from==&quot;the_output_for_comm1&quot;?&quot;<img src='comm1.gif'>&quot;:&quot;<img src='comm2.gif'>&quot;;

?>

Rick
 
Thanks rick for the reply.
Your suggestion works fine until we get to the community page. But once we get there it shows the old logo if i click on any menu items!

is there any way of using a cookie of some sort and tie it to the session? so that when the user clicks on a link, the cookie is created... and i'll check the cookie to see where the user originally came from as oppose where the user just came from... do i make sense?
 
In both community pages, add this:

<?

session_start();
if($HTTP_REFERER==&quot;/*from community 1*/&quot;)
$img_name=&quot;logo1.gif&quot;;
SESSION_REGISTER(&quot;img_name&quot;);
} else{
$img_name=&quot;logo2.gif&quot;;
SESSION_REGISTER(&quot;img_name&quot;);
}

?>

Then, in everypage, do this:

<img src=&quot;<?= $img_name ?>&quot;>

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top