Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Directory Submission Service   I Sell Pagerank   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 09-26-2007, 09:33 AM   #1 (permalink)
Moderator
 
watley's Avatar
 
Join Date: 07-26-06
Location: Illinois
Posts: 1,913
iTrader: 0 / 0%
Latest Blog:
None

watley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest order
Php includes with relative links?

Our company has a website, hosted on our own server, which uses php includes for the header and navigation elements. To get the includes to work, for some reason, we have to use the root path, e.g.

("/Library/WebServer/Documents/Website/layout/header.php")

It looks as though we ought to be able to use

("../Website/layout/header.php")

instead, but it just plain won't work. The problem is, moving the site means changing the root path everywhere. A pain. Any suggestions as to why the shortcut won't work, or is there something else I ought to be trying?
__________________
---> This space intentionally left blank. <---
watley is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 09-26-2007, 10:50 AM   #2 (permalink)
Contributing Member
 
Join Date: 02-10-07
Posts: 369
iTrader: 2 / 100%
Latest Blog:
None

ScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of light
Without seeing the actual site structure in more detail let me throw out two things which you probably know already.

If the page is loaded from a directory under the main site pages you would use ../../ not the single set. If all the include files are in a directory under the main directory and all the pages are in the main directory you would not use any ../ , you would simply have include directory/filename.

There is also a trick you can use to establish relative links by using and parsing the the CWD() , the php_self and script_filname functions. There is a way to do it with each.

Did I help or confuse you? I'm willing to try again.
__________________
ScriptMan
Gardening?
ScriptMan is offline  
Add Post to del.icio.us
Reply With Quote
Old 09-26-2007, 01:40 PM   #3 (permalink)
Moderator
 
watley's Avatar
 
Join Date: 07-26-06
Location: Illinois
Posts: 1,913
iTrader: 0 / 0%
Latest Blog:
None

watley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest order
Aha aha aha! The extra ../ for each directory did the trick. Many many thanks sir!
__________________
---> This space intentionally left blank. <---
watley is offline  
Add Post to del.icio.us
Reply With Quote
Old 09-26-2007, 02:47 PM   #4 (permalink)
Contributing Member
 
Join Date: 02-10-07
Posts: 369
iTrader: 2 / 100%
Latest Blog:
None

ScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of lightScriptMan is a glorious beacon of light
Great.

That confused the h*** out of me for a long time before I figured it out. Glad I could help.
__________________
ScriptMan
Gardening?
ScriptMan is offline  
Add Post to del.icio.us
Reply With Quote
Old 09-26-2007, 06:28 PM   #5 (permalink)
Moderator
 
watley's Avatar
 
Join Date: 07-26-06
Location: Illinois
Posts: 1,913
iTrader: 0 / 0%
Latest Blog:
None

watley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest orderwatley is a web professional of the highest order
It's been on the back burner for a year or so. I'm very glad it's sorted out.
__________________
---> This space intentionally left blank. <---
watley is offline  
Add Post to del.icio.us
Reply With Quote
Old 09-27-2007, 09:32 AM   #6 (permalink)
Empress™
 
chicgeek's Avatar
 
Join Date: 08-19-04
Location: York, UK
Posts: 17,965
iTrader: 0 / 0%
Latest Blog:
My Favourite Poem

chicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest order
*cheers*
__________________
laura / chicgeek
soprano & web designer
laurakishimoto.ca
chıcgeeĸ @ flickr
chicgeek is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is truth relative? John Scott Politics 239 02-13-2008 09:51 AM
relative ads tytyguy Google Forum 0 08-07-2006 09:15 AM
Relative URL Question realestate Web Design Lobby 4 12-05-2004 03:17 PM
PHP dynamic includes vs ASP dynamic includes question! imaginemn Coding Forum 1 06-17-2004 06:55 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 02:03 PM.
© Copyright 2008 V7 Inc

Click Here