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
Php Includes help Required
Old 06-29-2005, 08:38 AM Php Includes help Required
sameer785's Avatar
Super Talker

Posts: 115
Location: Kathmandu,Nepal
Trades: 0
I am building a new site which uses php includes in the home page. In the other pages which are in some other subfolders, I want to use the same navigation and header includes. But if I use the same includes in the index.php and other files in other folders, the images, animation etc. will not work.
For eg., the image topleft is the logo. It is in the image sfolder. So in the logo.php file the code will be <img src="images/topleft.gif"> which will work for the home page well. But in other pages, the code will simply not worl because hte folder images is not in the folder where the files are.
Could someone please help me out with this. I think I had read something about $_server['http_host'] a long time age which was related to this.
__________________

Please login or register to view this content. Registration is FREE
sameer785 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-29-2005, 10:18 AM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
just use a forward slash before the path to the images, like this:
<img src="/images/topleft.gif">

This will instruct the browser to start at the root of your site (/) and look for the images folder. Without the forward slash, your browser will always start at the current subdirectory.
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 06-30-2005, 11:47 PM
reli4nt's Avatar
Extreme Talker

Posts: 168
Location: New York
Trades: 0
You could use absolute urls
__________________

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

Designing the world we live in.
Defining the terms we live by.
reli4nt is offline
Reply With Quote
View Public Profile Visit reli4nt's homepage!
 
Old 07-01-2005, 09:06 AM
MightyMaster's Avatar
Ultra Talker

Posts: 401
Location: Appleton, WI
Trades: 0
I wouldn't use absolute urls though ... you are better off with the "/" trust me ... I just moved two huge sites ... one used absolute urls and the other used "/". I had to go into every page that had an absolute url and change it. All my sites now use the "/" to pull from the root.
MightyMaster is offline
Reply With Quote
View Public Profile
 
Old 07-01-2005, 09:11 AM
reli4nt's Avatar
Extreme Talker

Posts: 168
Location: New York
Trades: 0
Good point
__________________

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

Designing the world we live in.
Defining the terms we live by.
reli4nt is offline
Reply With Quote
View Public Profile Visit reli4nt's homepage!
 
Old 07-01-2005, 05:26 PM
metho's Avatar
Ultra Talker

Posts: 481
Location: Gold Coast - Brisbane QLD, Australia
Trades: 0
Have you ever installed a script which asks you for the URL of the site? The URL is stored in a configuration file for the purpose of concatenating to partial URLs to form absolutes.

Create a config.php file and include a var called $root with the value 'http://www.myDomain.com/'

Include the config file with your pages and concatenate URL's to give absolutes; e.g. $root.'images/logo.gif';
__________________
I do
Please login or register to view this content. Registration is FREE
based.
Spend a lot of time in
Please login or register to view this content. Registration is FREE
.
And
Please login or register to view this content. Registration is FREE
chews up the rest.
metho is offline
Reply With Quote
View Public Profile Visit metho's homepage!
 
Reply     « Reply to Php Includes help Required
 

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.82534 seconds with 12 queries