Programming, website development forum Get latest updates by RSS Follow TechnicalTalk on Twitter Follow TechnicalTalk on Facebook 
HomeSearchRecent PostsLoginRegisterContact Us

Username  
Password    
  Forgot your password?  

Pages: [1]   Go Down
 
  Email this topic  |  Print
0 Members and 1 Guest are viewing this topic.

Php includes in folder indexes.

 
webmaster forum
susapra  Offline
Activity
0%
 
New Poster
Posts: 9
Topics: 9
November 09, 2008, 03:28:30 AM

Well In my public_html folder I have a header php file and a footer php file.

In my index page I use php inlcudes to include my files.

My question is when i make a new folder how can i put includes into the index of the folder. Becaue I want to have sitename.com/contact instead of sitename.com/contact.php

The only way that worked for me was in the include for the url i put

/home/mysite/mypath/*.php and in the stylsheet in header php i had to
put the stylesheet url as http://sitename.com/style.css.

So i was just wondering if there were any better ways to work around it.

O and dont want to put the php files in each folder because that would defeat the purpose of includes.



« Last Edit: December 19, 2008, 02:45:40 AM by polas »
 
webmaster forum
polas  Offline
Activity
33.33%
 
Code Guru
Gender: Male
Posts: 1399
Topics: 85
WWW
November 10, 2008, 06:06:05 AM

If I understand what you are trying to achive then

if you have a directory called public_html, in it 2 files footer.php and header.php. Then you have a directory called contacts, in it a file called index.php

In index.php (in the contacts directory) you would have include '../footer.php'; and include '../header.php';

the ../ means go into the previous directory

Does this solve the problem?

Nick

Mesham Type Oriented Parallel Programming Language, Free online technical support
 
webmaster forum
Kailash  Offline
Activity
0%
 
New Coder
Posts: 31
Topics: 10
December 18, 2008, 10:13:40 PM

You have two options here:

[1] Use ../ in your include path as mentioned by Nick.
Code:
include ('../footer.php');

[2] You can use your full physical path:
Code:
include('/home/user/public_html/footer.php');

Kailash
 
  Email this topic  |  Print
Pages: [1]   Go Up
 
Jump to:  



Powered by SMF 1.1.15 | SMF © 2011, Simple Machines


Google visited last this page February 05, 2012, 08:26:50 PM