Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

VERY basic php question

  • 07-06-2006 05:14PM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 Posts: 35,522 ✭✭✭✭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,144 ✭✭✭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, Registered Users 2 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