Solved

include page with domain

Posted on 2006-11-02
5
214 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

809 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