• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

include page with domain

hello,
I have many domains and I would like to include a page
that if comes from domain1.com or domain2.com

make it like this

<? include("http://domain1.com/footer.php"); ?>

<? include("http://domain2.com/footer.php"); ?>

how can i do this?
0
Sabrin
Asked:
Sabrin
  • 3
  • 2
1 Solution
 
HackneyCabCommented:
I'm not entirely clear on what you're asking.

If you want domain1.com to include the file domain1.com/footer.php, but domain2.com to include the file domain2.com/footer.php using the same code, then could you use this:

include('/footer.php');

That uses an absolute path that looks for footer.php in the root directory. So if the current script is in the space for domain1.com, then PHP should ask for domain1.com/footer.php and so on. I think that would work even if the domains were on the same server. (So long as the domains didn't point to the same directory.)
0
 
SabrinAuthor Commented:
<? include("DOMAIN WHERE YOU CAME FROM/footer.php"); ?>
0
 
SabrinAuthor Commented:
instead of  this
<? include($_SERVER["DOCUMENT_ROOT"]."/galleries/main/header.php"); ?>
/home/etc/site/galleries/main/header.php

i want something like this
<? include($_SERVER["DOMAIN"]."/galleries/main/header.php"); ?>
http://domain.com/galleries/main/header.php
0
 
SabrinAuthor Commented:
<? include($_SERVER["HTTP_HOST"]."/galleries/main/header.php"); ?>
only shows this
domain.com/galleries/main/header.php

I need the http://
0
 
HackneyCabCommented:
Is there a reason why you can't add that scheme in your code:

<? include('http://'.$_SERVER["HTTP_HOST"].'/galleries/main/header.php'); ?>
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now