Please help define root directory for php include in subdirectory!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • jspca7857
    Corporal

    • Sep 2009
    • 13

    Please help define root directory for php include in subdirectory!

    Hello everyone; I am in desperate need of some help with this!

    I am constructing a website with css and php_includes. My problem is that I do not know how to reference the root directory (where the includes file is) from within a deep-rooted subdirectory.

    I know that I can reference a file in the root directory from "root/sub/file" by prefixing the includes path with "../", however how can I reference the root from "root/sub/sub/file"?

    I really would appreciate any help here as I have been searching the internet for an answer for the last three days!

    Thank you for your time,

    - Benjamin.
    - Benjamin Langlois (www.benjaminlanglois.com)
  • millie
    First Lieutenant

    • Apr 2009
    • 170

    #2
    Re: Please help define root directory for php include in subdirectory!

    Hi

    This is a theory ok? Seems to me that all you have to do is to www.domain.com/include. Looks like you have been in the guru level and forgot the basic level. However, as I said, this is theory.

    Cheers

    Millie
    Millie
    www.subeagle.com

    Comment

    • navaldesign
      General & Forum Moderator

      • Oct 2005
      • 12080

      #3
      Re: Please help define root directory for php include in subdirectory!

      Most VH servers are set NOT to allow URL includes. So the solution posted by millie won't work.

      You can reference your includes file as:

      /home/cpusername/public_html/includes_file.php if you are on a VH account .
      Navaldesign
      Logger Lite: Low Cost, Customizable, multifeatured Login script
      Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
      DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
      Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

      Comment

      • millie
        First Lieutenant

        • Apr 2009
        • 170

        #4
        Re: Please help define root directory for php include in subdirectory!

        Hi

        So, that means the include codes are in the include_file.php, right? But /home/cpusername/public_html/... would really say (in my case)
        /www.subeagle.com/mycpusername/pub... (with the www in front of subeagle), right NavalDesign?

        Thanks

        Millie
        Millie
        www.subeagle.com

        Comment

        • navaldesign
          General & Forum Moderator

          • Oct 2005
          • 12080

          #5
          Re: Please help define root directory for php include in subdirectory!

          So, that means the include codes are in the include_file.php, right?
          Correct, or whatever else the file to be included is called.


          But /home/cpusername/public_html/... would really say (in my case)
          /www.subeagle.com/mycpusername/pub... (with the www in front of subeagle
          No, i mean what i wrote: /home/cpusername/public_html/

          No www, no subeagle.com. Just replace the "mycpusername" with your real CP username.

          This is the path to your root folder.
          Of course this assumes that the file you need to include is in your root folder, as you posted above.
          Navaldesign
          Logger Lite: Low Cost, Customizable, multifeatured Login script
          Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
          DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
          Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

          Comment

          Working...
          X