Jump to content

Archived

This topic is now archived and is closed to further replies.

pjrobertson

Is it possible 'if' or 'else'?

Recommended Posts

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)
[code]<?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>
}
[/code]
No idea if that makes sense.

Thanks :)

Share this post


Link to post
Share on other sites
Something like:
[code]<?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>';
}[/code]

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.