Jump to content


Photo

Is it possible 'if' or 'else'?


  • Please log in to reply
2 replies to this topic

#1 pjrobertson

pjrobertson
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 04 June 2006 - 06:18 PM

New to this stuff, and I was wondering whether there was a wya to use the if / else command to open a link in a new window depending on the circumstances.
What I want to do is make a link open in a new window if a person has been refered from a particular address.

If you're familiar with hit sites, you'll know people browse through sites with a frame in the top of the screen connected to the hit site. What I want to do is make it possible for people to open my links in new windows if they are viewing it in a frame.

[a href=\"http://http://www.ts25.com/surf/surf.jsp?surfer=pjrobertson\" target=\"_blank\"]here's[/a] a link to a hit site, where you can see what I mean about surfing websites.

It might all sound a bit wierd, but I'm not sure if it's possible!

[a href=\"http://www.gangguevara.com\" target=\"_blank\"]Here's[/a] a link to my index page (the page where I want links to open in a new window) so you can see what I want to change.
It would be something like (I've just made the code up! Just to show you what I mean)
<?php 
if ( $refering_url = ['http://www.ts25.com/surf/surf.jsp'] ) 
{
'<a href=Home.html target=_blank>English</a>'
}
else 
{
<a href=Home.html>English</a>
}
No idea if that makes sense.

Thanks :)

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 June 2006 - 06:26 PM

Something like:
<?php
if ( $_SERVER['HTTP_REFERER'] == 'http://www.ts25.com/surf/surf.jsp )
{
    echo '<a href="Home.html" target="_blank">English</a>';
}
else
{
    echo '<a href="Home.html">English</a>';
}


#3 pjrobertson

pjrobertson
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 04 June 2006 - 06:54 PM

Thanks, just the right thing....except I've realised that it's not a refering url, because the page is being viewed in a .jps file, it's showing my site inside another one.
Any way to get round that?! Or will the refering url work?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users