Solved

include page with domain

Posted on 2006-11-02
5
211 Views
Last Modified: 2013-11-18
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
Comment
Question by:Sabrin
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:HackneyCab
ID: 17863373
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
 

Author Comment

by:Sabrin
ID: 17863391
<? include("DOMAIN WHERE YOU CAME FROM/footer.php"); ?>
0
 

Author Comment

by:Sabrin
ID: 17863473
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
 

Author Comment

by:Sabrin
ID: 17863487
<? include($_SERVER["HTTP_HOST"]."/galleries/main/header.php"); ?>
only shows this
domain.com/galleries/main/header.php

I need the http://
0
 
LVL 16

Accepted Solution

by:
HackneyCab earned 500 total points
ID: 17863863
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
This article discusses four methods for overlaying images in a container on a web page
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now