Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Include Header in Subdirectories
Old 03-14-2005, 12:51 PM Include Header in Subdirectories
Novice Talker

Posts: 9
Trades: 0
I'm converting my site to PHP in order to include one header file in every file. However, my site is organized such that I have a "videos" directory which contains many more pages, and I want to include the same header file on these pages. For some reason, the statement

<?php include("/header.php");?>

does not look for the file in the root directory, unlike the statement

<link rel="stylesheet" type="text/css" href="/style.css">

I'm new to PHP; is the syntax of that invalid? I do realize that I can include("../header.php"), but I like referring to things absolutely in case I move files around. And no, I don't want to include it as an absolute URL, because I need to develop things offline. Is there any way to do this in PHP?

Thanks,
-Duff
__________________
http://duffx.com
Duffx is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-14-2005, 01:00 PM
Novice Talker

Posts: 9
Trades: 0
Well, I found the problem... It's that the absolute URL of my header.php file on my home machine apache install is

W:\www\header.php

However, on my webhost, it's

/homepages/31/d88275995/htdocs/header.php

Hmmm... Any recommendations, or is ../header.php my best bet?
__________________
http://duffx.com
Duffx is offline
Reply With Quote
View Public Profile
 
Old 03-14-2005, 01:08 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
You can use either a relative path (../header.php) or an absolute path (/homepages/31/d88275995/htdocs/header.php), as far as PHP is concerned, they are the same.

The relative path just might make it easier going from host to host, or from your computer to your server etc.
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Include Header in Subdirectories
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12099 seconds with 12 queries