Goedkope merkkleding op www.kleren.com

PHP Include

Need help or support ? Post your issues and problem here!

Moderator: Moderators Team

PHP Include

Postby xjuniorx on Thu May 22, 2008 1:54 am

Im trying to use this code
<?php
include "php/header.php";
include "php/menu.php";
include "php/content.php";
include "php/sidebarfooter.php";
?>


but the problem is that all these files are in one directory witch is the php one.

Now the folder i have this file in is in another directory.

Look..heres a screenshot and how is the right way to put the php include code with all my files in...
Image
xjuniorx
 
DNBucks:
[ Donate DNBucks ]

Re: PHP Include

Postby gimgak on Thu May 22, 2008 9:00 pm

Finder wrote:srry man
i dont know anything about these things

then don't post in something you don't know about. It's just a waste lol
User avatar
gimgak
Advanced Member
Advanced Member
 
Posts: 972
Joined: Sat May 10, 2008 10:29 pm
DNBucks: 75
[ Donate DNBucks ]
Blog: View Blogs (2)

Re: PHP Include

Postby pSyChO mOnkee on Fri May 23, 2008 3:28 am

try using
Code: Select all
../../php/file.php
or
Code: Select all
/../../php/file.php

what this does is go up two directories from where you are, then navigate to php/file.php
User avatar
pSyChO mOnkee
Administrator
Administrator
 
Posts: 972
Joined: Sat Jul 14, 2007 7:05 am
Location: £arth
DNBucks: 1944
[ Donate DNBucks ]
Blog: View Blogs (1)

Re: PHP Include

Postby xjuniorx on Fri May 23, 2008 3:29 am

It worked perfect! Thanks!
xjuniorx
 
DNBucks:
[ Donate DNBucks ]

Re: PHP Include

Postby Looky on Wed Jul 30, 2008 1:52 am

Speaking about pgp include... what's the point in putting a dot before the folder? eg: "./php/file.php"? isn't it the same as "php/file.php"?
The domanins I bought with the help of DNTemple: YMStatus.com and YMStatus.info
User avatar
Looky
Advanced Member
Advanced Member
 
Posts: 524
Joined: Mon Nov 12, 2007 7:36 pm
Location: Oradea, Romania
DNBucks: 40
[ Donate DNBucks ]
Blog: View Blogs (1)

Re: PHP Include

Postby xjuniorx on Sun Aug 03, 2008 3:14 am

There are from other directories thats why.
xjuniorx
 
DNBucks:
[ Donate DNBucks ]

Re: PHP Include

Postby raghu3586 on Wed Aug 13, 2008 3:03 pm

:wink: FROM MATRIX BOSS PRUTHVI THANKssssssss :mrgreen:
raghu3586
 
DNBucks:
[ Donate DNBucks ]

Re: PHP Include

Postby Brothers on Thu Aug 14, 2008 4:59 am

thanks for....???
Brothers
Advanced Member
Advanced Member
 
Posts: 813
Joined: Fri Aug 08, 2008 1:34 pm
DNBucks: 100
[ Donate DNBucks ]

Re: PHP Include

Postby Sterex on Thu Aug 14, 2008 10:56 am

In Php (and also almost all programming languages) . 'dot' means the current directory and a .. 'double-dot' means the directory one level up from the current directory. :)
Regards,
Manoj Sterex
User avatar
Sterex
Administrator
Administrator
 
Posts: 1241
Joined: Thu Jul 05, 2007 11:21 am
Location: India
DNBucks: 11
[ Donate DNBucks ]

Re: PHP Include

Postby ridwansameer on Thu Aug 14, 2008 12:54 pm

Sterex, does that mean that a triple dot means it is in a directory more inside?, like a sub director in a sub directory?
User avatar
ridwansameer
Advanced Member
Advanced Member
 
Posts: 654
Joined: Mon Mar 17, 2008 3:52 pm
Location: Rapping to the @%#$$@% Stars
DNBucks: 1194
[ Donate DNBucks ]

Re: PHP Include

Postby dramaprincessxox on Tue Aug 19, 2008 8:10 pm

Looky wrote:Speaking about pgp include... what's the point in putting a dot before the folder? eg: "./php/file.php"? isn't it the same as "php/file.php"?


The person didn't use one dot... what he did does have a point...
dramaprincessxox
Member
Member
 
Posts: 481
Joined: Mon Aug 18, 2008 12:00 am
DNBucks: 232
[ Donate DNBucks ]

Re: PHP Include

Postby demonix on Sun Aug 24, 2008 12:26 am

epically useful information there... I didn't know you could go up a directory with the include statement...
demonix
Junior Member
Junior Member
 
Posts: 178
Joined: Sat Aug 23, 2008 6:01 pm
DNBucks: 85
[ Donate DNBucks ]
Blog: View Blogs (1)

Re: PHP Include

Postby TheUniqueTiger on Sun Aug 24, 2008 7:06 am

Let me clear things up...

./abc.php means the same directory as relative to the triggering script file... like index.php
abc.php means the same directory as relative to the currently executing script file. If the current executing file is an included file from another folder, PHP will take this folder as the folder to include the file abc.php.
../abc.php means the file from the parent directory of the current folder as correctly said earlier.

So if you are working with included files, work carefully with "abc.php" and "./abc.php"
Make the most of the time you have!
My project: HiFiBB ... Simply HiFi!
My Home
User avatar
TheUniqueTiger
Administrator
Administrator
 
Posts: 606
Joined: Mon Oct 01, 2007 4:44 pm
Location: India
DNBucks: 1130
[ Donate DNBucks ]

Re: PHP Include

Postby Webmaster on Tue Aug 26, 2008 3:59 pm

go
Webmaster
 
DNBucks:
[ Donate DNBucks ]

Re: PHP Include

Postby dramaprincessxox on Wed Aug 27, 2008 6:34 pm

gimgak wrote:
Finder wrote:srry man
i dont know anything about these things

then don't post in something you don't know about. It's just a waste lol


Wow...
that's something... :?:
dramaprincessxox
Member
Member
 
Posts: 481
Joined: Mon Aug 18, 2008 12:00 am
DNBucks: 232
[ Donate DNBucks ]


Return to Web Development Help and Support

Who is online

Users browsing this forum: No registered users and 0 guests

cron