Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VERY basic php question

Options
  • 07-06-2006 5:14pm
    #1
    Registered Users Posts: 673 ✭✭✭


    Ok, this is driving me mad. I have been learing php from home but the book i have doesnt clarify this. When im using something like "include()" im not sure how to specify which folder location to open. Sometimes i put in ../myfolder/myfile.php and it works and then other times i just put myfolder/myfile.php and it works so i just end up messing about with it until it works.

    The problem really arises when im when different pages are using the same file, then some of my pages get errors about not being able to find a file. I cant get it to work at all if i have a file in a subfolder trying to link to a file in another sub folder.

    I know this is basic stuff so can someone please explain to me how its done?

    Thanks


Comments

  • Registered Users Posts: 35,524 ✭✭✭✭Gordon


    You have to have a file that states what includes relate to what file.

    Download a copy of phpbb for example and have a root around the files if you don't get an answer by the time you read this.


  • Closed Accounts Posts: 7,145 ✭✭✭DonkeyStyle \o/


    I use $_SERVER then append any sub-paths you need to the end of that string... that way you've got an absolute path to the include file that'll work for calling files from where ever on the site.


  • Registered Users Posts: 673 ✭✭✭Bananna man


    I use $_SERVER then append any sub-paths you need to the end of that string... that way you've got an absolute path to the include file that'll work for calling files from where ever on the site.

    Cheers, thats got it sorted!!


Advertisement