Jump to content

Include One menu across many domains


brihan

Recommended Posts

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

Link to comment
Share on other sites

*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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.