Page 1 of 1

php include via udt - how do i get target_self?

Posted: Mon Oct 04, 2010 9:59 pm
by lainyrache
I have added an external php script via a UDT to my content page.
Everything works fine except i want each link within the script to target self.
( at the moment every link from the script takes me away from cms and onto the external php script)
The external script php has $_SERVER['PHP_SELF'];  set.
Do i need  bespoke coding or does any one know a quick way to fix this.


UDT test one..
include("/home/client/public_html/folder1/newscript.php");
results in url linking like
http://www.client.co.uk/index.php?jabs=1


UDT test two
$includeFile = file_get_contents("http://www.client.co.uk/folder1/newscript.php");
echo $includeFile;

results in url links like www.client.co.uk/folder1/newscript.php?jabs=1

A massive thanks for any tips or guidance.

Re: php include via udt - how do i get target_self?

Posted: Tue Oct 05, 2010 7:43 am
by Peciura
To include php to UDT there should not be '' in yout file.
Consider using$_SERVER['REQUEST_URI'] or $_SERVER['REQUEST_URL'] instead of $_SERVER['PHP_SELF'].

Solved: Re: php include via udt - how do i get target_self?

Posted: Thu Oct 21, 2010 8:46 am
by lainyrache
Hi sorry for the delay getting back on this. Thank you for tips above.
It was all set up okay.. just the url rewrites were confusing.
I used $_SERVER['PHP_SELF'];
then altered all direct links for rewrites from eg
?ac=search">Search

to

?page=pagename&ac=search">earch
Its a bit specific to this script ( and probably not ideal to do it this way) but might help someone further down the line.