pjrobertson Posted June 4, 2006 Share Posted June 4, 2006 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 :) Quote Link to comment https://forums.phpfreaks.com/topic/11178-is-it-possible-if-or-else/ Share on other sites More sharing options...
wildteen88 Posted June 4, 2006 Share Posted June 4, 2006 Something like:[code]<?phpif ( $_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] Quote Link to comment https://forums.phpfreaks.com/topic/11178-is-it-possible-if-or-else/#findComment-41805 Share on other sites More sharing options...
pjrobertson Posted June 4, 2006 Author Share Posted June 4, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/11178-is-it-possible-if-or-else/#findComment-41824 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.