Jump to content


Photo

Problem including file from other directory


  • Please log in to reply
2 replies to this topic

#1 Daze

Daze
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 March 2006 - 04:39 AM

Hello all,

I'm quite a newbie with php and I hope this is an easy-to-solve newbie problem. This is part of my application directory structure:

root/index.php
root/config.php
root/pages/main/login.php
root/lib/func.php
root/lib/funclogin.php

and I am using smarty templates. The problem is the following:

when I include func.php & config.php in login.php as the following:
include_once('../lib/func.php');
include_once('../config.php');

it will warn me that the files can not be found. Am I doing something wrong here or is it something else?

Thanks in advance.

Cheers,
Daze

#2 keeB

keeB
  • Staff Alumni
  • Advanced Member
  • 1,078 posts
  • LocationCalifornia

Posted 10 March 2006 - 06:59 AM

include_once('../../lib/func.php');
include_once('../../config.php');

you gotta realize.. each '../' is like going back one folder.. not starting from the beginning :)

Come visit my site to see my latest projects
http://nick.stinemates.org/wordpress/


#3 Daze

Daze
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 March 2006 - 08:27 AM

you are right. Thanks!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users