PDA

View Full Version : php include



nikomou
10-16-2005, 09:07 AM
Hi,

I want to change the php include when someone clicks on a link on the page. Does anyone know if this is possible?

Twey
10-16-2005, 11:03 AM
Of course it is. Make the link pass a GET variable, then check for that variable when you call the include.

nikomou
10-16-2005, 12:57 PM
Hi Twey, Thanks for your help once again!!

How would i go about doing this?
So for, all I have is:

<?php include("http://www.mysite.com/iframe.asp?hs=xxxx"); ?>

What would i have to do to the link to change the url in that php include??

Twey
10-16-2005, 01:47 PM
Say the page that includes that is called page.php.

<?php if($_GET['inc'] == "zzzz") include("http://www.mysite.com/iframe.asp?hs=xxxx");
else include("http://www.mysite.com/iframe2.asp?hs=yyyy"); ?>
Then, if the page was accessed as page.php?inc=zzzz it would include iframe.asp?hs=xxxx; otherwise, it would include iframe2.asp?hs=yyyy.

nikomou
10-16-2005, 03:00 PM
thank you!! works fantasticly

nikomou
10-16-2005, 08:23 PM
OK, so now what i've done is:

On the page handset.php, the value of the parametre "network" changes the "php include". Could you add another parametre called "tracking" to change another part of the url in the "php include" ??

But i want the tracking parametre to work whatever the network parametre is...

Twey
10-17-2005, 04:41 PM
<?php if($_GET['network'] == "zzzz") include("http://www.mysite.com/iframe.asp?hs=xxxx");
else include("http://www.mysite.com/iframe2.asp?hs=" . ($_GET['tracker'] == 'wwww' ? 'vvvv' : 'yyyy')); ?>
Goes to iframe2.asp?hs=vvvv if tracker is wwww; otherwise, goes to iframe2.asp?hs=yyyy.