Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-03-2004, 10:58 AM
MrLeN's Avatar
WebProWorld Veteran
 

Join Date: Jul 2003
Location: Melbourne, Australia
Posts: 541
MrLeN RepRank 0
Default php include question

Um.. you might have to read this two or fifteen times, to get what I mean - lol

I have 12 domains and I am trying to build them all using "one" header and footer template.

I simply have some code like this:

Code:
<? include("/home/site1/public_html/serverwide/header.php"); ?>
<? include("/home/site1/public_html/forums/index.html"); ?>
<? include("/home/site1/public_html/serverwide/footer.php"); ?>
However, in the header file, I have an [problematic] include for a tab menu. Of course, if I have 12 different domains - I'll need 12 different tab menu's!

My problem is that I can't set the include from the home directory, because I want eash site to use a specific template like this:

Code:
<?php include("/home/site1/public_html/serverwide/tabmenu.php"); ?>
However, because the above code is in the MAIN header template, which is being used for all of my domains {ie: there is only ONE maain header file) - I can't have the /site1/ part in it. I need the template to use the tab menu from the site that it is being called from.

Can anyone show me how to do this?

This might look really dumb, (and I KNOW) it doesn't work - but I need to get the above code to work like this:

Code:
<?php include("public_html/serverwide/tabmenu.php"); ?>

..instead of this:

Code:
<?php include("/home/site1/public_html/serverwide/tabmenu.php"); ?>
MrLeN
Reply With Quote
  #2 (permalink)  
Old 01-03-2004, 11:12 AM
MrLeN's Avatar
WebProWorld Veteran
 

Join Date: Jul 2003
Location: Melbourne, Australia
Posts: 541
MrLeN RepRank 0
Default Progress

I have "some" progress.

I have managed to get thetab menu to show with this code:

Code:
<?php include("tabmenu.php"); ?>
..however, it only works for pages in the root dir of each website. It wont work in sub dir's unless I have the tabmenu file in them also.

That sucks..

Can anyone help?

MrLeN
Reply With Quote
  #3 (permalink)  
Old 01-03-2004, 11:18 AM
MrLeN's Avatar
WebProWorld Veteran
 

Join Date: Jul 2003
Location: Melbourne, Australia
Posts: 541
MrLeN RepRank 0
Default

is there some code to say that:

if the site is being rendered from site "x" then it will display tab menu "x"..

if the site is being rendered from site "y" then it will display tab menu "y"..

etc..

if I put a /backslash it tries to take the file from the root of the SERVER not the domain. If I DON't have the backslash, it works - but only from the top dir of the domain, not in sub dirs of the domain.

MrLeN
Reply With Quote
  #4 (permalink)  
Old 01-03-2004, 11:43 AM
MrLeN's Avatar
WebProWorld Veteran
 

Join Date: Jul 2003
Location: Melbourne, Australia
Posts: 541
MrLeN RepRank 0
Default Success!

Ah - Here's what I needed:

Code:
<?php include("$DOCUMENT_ROOT/tabmenu.php"); ?>
Thanks everyone!

MrLeN
Reply With Quote
  #5 (permalink)  
Old 01-03-2004, 02:01 PM
paulhiles's Avatar
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: UK
Posts: 2,803
paulhiles RepRank 0
Default LOL!! No problem

LOL!! No problem, MrLeN! Great to see that you've worked through the problem (with yourself!), and found your answers!

Good to see you around the forums again,

Paul
Reply With Quote
  #6 (permalink)  
Old 01-05-2004, 01:55 AM
redcircle's Avatar
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Grand Rapids, MI USA
Posts: 553
redcircle RepRank 0
Default

Just a suggestion. To make your code correct I would use $_SERVER['DOCUMENT_ROOT'] instead of just $DOCUMENT_ROOT

it will save you lots of headaches if you ever have to turn register_globals = off.
__________________
www.squitosoft.com - PHP development site. featuring Squito Gallery. a php driven photo gallery.
www.rgfx.net - Specializing in Internet solutions, including Html authoring, Interactive Web sites, 3D/2D Graphics and animation.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0