brihan Posted February 26, 2008 Share Posted February 26, 2008 Hi, I have many different domains but there is some common information that I would like to include with all of them. How can I have one file or URL that can be included across many domains? I would like to be able to just upload one file like: http://www.mydomain.com/includes/include-info.php and then be able to add something like <?php include("http://www.mydomain.com/includes/include-info.php");?> into all of my other sites. What would be the best way to do something like this? Thank you for any help or information you can provide. Brian Quote Link to comment Share on other sites More sharing options...
php_dave Posted February 26, 2008 Share Posted February 26, 2008 *EDIT* Read your post correctly the second time and realsied that you are talking cross domain includes - this is possible exactly have you had descrbed above but you need to have URL Fopen Wrappers enabled (which is by default) - also the server where you are pulling the include file from will actually parse the PHP file rather than the domain that calls it - check out - http://uk.php.net/include/ ***EDIT*** --- Left the below for anyone looking for info on same server includes --- You could do it the way you have selected above but as long as you sites are stored along your web dir root then you can include outside of your actual site path.. for example -- WebRoot -- Website1 -- Website2 -- Wesbite3 -- Global_Includes -- menu.php For all of the websties you could add include '../Global_Includes/menu.php'; just add 1 ../ per level you need to go down... I think there are other ways using System vars (like SERVER_PATH) but in my experience this lends to full path decs in your generated code so I tend to use the above. Hope this helps Dave Quote Link to comment 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.