Add to Google

Does Php Include Work? - not for me aparantly... ?

Pages: 1, 2
free web hosting
Open Discussion > General > Trapinion - Your Voice! Your Review!

Does Php Include Work? - not for me aparantly... ?

jlhaslip
Just a reminder that PHP6, soon to be released, will not allow Register Globals at all, whatsoever, so you are better to learn to code without using Register Globals = on.

Also, with resect to the single dot and double dot method of addressing a file:

This syntax is a left-over from the days of DOS Operating System where a single dot meant "this directory" and the double dot meant "file's Parent Directory", so good programming practice would use the single dot syntax for a file in the Current directory ( include './filename.ext' ) and double dot syntax for the Parent directory ( include '../filename.ext' ) You can travel to several levels of Parent Directories by adding sets of double dots, too. ( include '../../../../filename.ext' ) would go back 4 levels.
Similarly, a slash without the dots is used to indicate the path to the file starts at the Server Root. ( include '/filename.ext' )

http://www.hardcoder.com/scripting/php/include_files.php

 

 

 


Comment/Reply (w/o sign-up)

sonesay
Thank you for pointing that out. I was confusd and always thought that ".../" meants two levels up. I will try this soon once I get back to working on my PHP project.

Comment/Reply (w/o sign-up)

BuffaloHELP
It is also a good coding method to practice isolation between Global Variable and Local Variable. wink.gif

Comment/Reply (w/o sign-up)

anachro
QUOTE(jlhaslip @ Jan 11 2008, 07:44 PM) *
This syntax is a left-over from the days of DOS Operating System where a single dot meant "this directory" and the double dot meant "file's Parent Directory", so good programming practice would use the single dot syntax for a file in the Current directory ( include './filename.ext' ) and double dot syntax for the Parent directory ( include '../filename.ext' ) You can travel to several levels of Parent Directories by adding sets of double dots, too. ( include '../../../../filename.ext' ) would go back 4 levels.
Similarly, a slash without the dots is used to indicate the path to the file starts at the Server Root. ( include '/filename.ext' )


I had no idea! so the basic concept is if the file is in the same directory of the operating page, jsut put ./filename.ext, but say its in root/file/ and your operational page is in root/file/file/ using ../filename.ext would allow it to work, correct?

 

 

 


Comment/Reply (w/o sign-up)

truefusion
QUOTE(jlhaslip @ Jan 11 2008, 08:44 PM) *
This syntax is a left-over from the days of DOS Operating System where a single dot meant "this directory" and the double dot meant "file's Parent Directory"

Actually, Unix uses this too. And Unix is a lot older than DOS. Unix, last i checked, came out in 1969.

But to add to your other statement: When you include the root directory by including a forward slash in the beginning of the file path, this does not neccesarily mean your "public_html" folder. It means the root of the system itself; assuming the system is a Unix-based system; other systems may be different.

QUOTE(anachro @ Jan 13 2008, 03:15 AM) *
... but say its in root/file/ and your operational page is in root/file/file/ using ../filename.ext would allow it to work, correct?

Assuming i understood you correctly: Yes, that would work. But it is a security flaw if you allow ../ in _GET variables without verifying the extension.

Comment/Reply (w/o sign-up)

musicmaza
no I didn't a problem like that because I don't use php too much and by the way many suggestions have been already given,so you may try ny one give in this thread,I know these t17 members are really far more experienced then I am,so I am not suggesting anything because I may suggest something wrong. smile.gif

Comment/Reply (w/o sign-up)

coolcat50
I never have had this problem. Of course I have all my files in the same directory at the moment, but my PHP includes work fine and I use the $_GET variable on some of my pages.

You can check it out at my site.

http://ninfanzone.uni.cc

I am using PHP include to get my CSS into my pages and for the menu at the top.

Comment/Reply (w/o sign-up)

anachro
QUOTE(musicmaza @ Jan 13 2008, 10:21 AM) *
no I didn't a problem like that because I don't use php too much and by the way many suggestions have been already given,so you may try ny one give in this thread,I know these t17 members are really far more experienced then I am,so I am not suggesting anything because I may suggest something wrong. smile.gif


yeah, as long as you use Include($_GET['blah.php']wink.gif you won't have the problem, or it could be the difference in what you are includeing , (visible/css style) content

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Pages: 1, 2
Recent Queries:-
  1. php include file syntax from root file - 23.03 hr back. (1)
  2. php includes do not work - 108.71 hr back. (1)
  3. php include 404 - 174.03 hr back. (1)
  4. php include does not work - 34.33 hr back. (3)
  5. how does php include work - 275.67 hr back. (1)
Similar Topics

Keywords : Php Aparantly


    Looking for php, include, work, aparantly,

Searching Video's for php, include, work, aparantly,




advertisement



Does Php Include Work? - not for me aparantly... ?