PHP to replace URL
Posted: Sat Sep 26, 2009 5:40 am
Hi guys,
This is probably easy for some of you, but cant figure it out myself and no luck on Googling.
Ok I have 3 websites on different domains & all sites are the same.. If I update an include file (say a menu/navigation) and the include has direct links to subfolders/page say: http://www.mysite.com/myfolder/mypage/index.php, I dont want to have to update all the links on each include, on all sites, I just want to update 1 include (master) and upload it to all sites, If you follow?
Maybe there is a simple javascript code to replace the URL example:but I'm hoping for similar method in PHP.
I tried to do a config.php include using
config.php
and replacing the url with this;
didnt work obviously, so is there an easier process for this that I can use?
Note: I'm not a PHP novice and the pages are html layout with php includes so pages are saved as php and are not just php language.
Would appreciate any help with this!
This is probably easy for some of you, but cant figure it out myself and no luck on Googling.
Ok I have 3 websites on different domains & all sites are the same.. If I update an include file (say a menu/navigation) and the include has direct links to subfolders/page say: http://www.mysite.com/myfolder/mypage/index.php, I dont want to have to update all the links on each include, on all sites, I just want to update 1 include (master) and upload it to all sites, If you follow?
Maybe there is a simple javascript code to replace the URL example:
Code: Select all
<a href="javascriptcode;myfolder/mypage/index.php">My page</a>I tried to do a config.php include using
Code: Select all
<?php include_once "includes/config.php"?>Code: Select all
<?php
$SITE_URL = 'http://www.ssdltd.com.au';
?>Code: Select all
<a href="<? php $SITE_URL; ?>myfolder/mypage/index.php">My page</a>Note: I'm not a PHP novice and the pages are html layout with php includes so pages are saved as php and are not just php language.
Would appreciate any help with this!