SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Bored One boredboi's Avatar
    Join Date
    Jul 2000
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm using xoasis, a free web host

    and i have a few html files on that host
    i also have a directory, named "about"

    i have a template.php file in "about"
    that uses includes to include the html files one directory above

    however it doesn't work.
    http://squeeky.xoasis.com/about/template.php

    this is the code i'm using...
    <? include("/file.html"); ?>

    how do i include the file that is one directory above?

    i don't think free web hosts provide access to the .htaccess file, so i can't set the php_include path...

  2. #2
    Not Bad, eh? Justin Sampson's Avatar
    Join Date
    Aug 2000
    Location
    N.S., Canada
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I understand.

    So your directory structure is like this:

    index.html
    stuff.html
    about --> template.php

    And say you want to include stuff.html

    Then template.php would use this to include files below it:

    <? include("../stuff.html"); ?>

    If your structure is like this:

    index.html
    about --> template.php --> html_folder--> stuff.html

    Then template.php would use this to include files above it:

    <? include("html_folder/stuff.html"); ?>

    Understand?

    If you don't just ask

  3. #3
    Bored One boredboi's Avatar
    Join Date
    Jul 2000
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes i thought of that....
    but it doesn't work..

    my code: <? include("../top.html"); ?>
    i tried <? include("/top.html"); ?> as well

    but it doesn't work either

    i get "Warning: Unable to include 'toplinks.html' - request execution failed in /home/squeeky/public_html/about/template.php on line 15"

    thanks for the speedy reply though.

  4. #4
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try using absolute paths instead of relative. If I understand correctly the file "top.html" is in this absolute path:

    /home/squeeky/public_html/top.html

    So try:

    <? include("/home/squeeky/public_html/top.html") ?>

    good luck.

  5. #5
    Bored One boredboi's Avatar
    Join Date
    Jul 2000
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks...
    it worked
    am i right to say this has something to do with the include_path value set in the server's php.ini?

  6. #6
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Correct. Your server's include path seems to be misconfigured.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •