Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: php include problem

  1. #1
    Join Date
    Oct 2008
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default php include problem

    I have a file.html that i want to include in other files, but the problem is that it works only in pages that are i root but files are in subdiretory for example root/images it don't works even if i pun ../../file.html, this is the code:


    <div id="Layer60"><?php include('../../meniu-principal.html'); ?></div>
    <div id="Layer62"><?php include('../../reclama.html'); ?></div>
    <div id="Layer63"><?php include('../../cod-postal.html'); ?></div>
    <div id="Layer64"><?php include('../../meteo.html'); ?></div>
    <div id="Layer65"><?php include('../../poza-zilei.html'); ?></div>
    <div id="Layer66"><?php include('../../Bancuri.html'); ?></div>
    <div id="Layer67"><?php include('../../meniu-bancuri.html'); ?></div>
    <div id="Layer68"><?php include('../../horoscop.html'); ?></div>

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    So you have some php working in your file.html?? I don't know how that's working but it should be file.php. Since your using php not just html in it, that may be your problem.

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Not enough information was provided. Where is the included file? Where is the including file?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Oct 2008
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by bluewalrus View Post
    So you have some php working in your file.html?? I don't know how that's working but it should be file.php. Since your using php not just html in it, that may be your problem.
    no man, the php code i put in an .php file, but in that .php file i want to include that .html files.

  5. #5
    Join Date
    Oct 2008
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    Not enough information was provided. Where is the included file? Where is the including file?
    the included file is on root and the including file is root/images/funny and in the inclding file i put the code: <?php include("../../horoscop.html"); ?> but the including file is a .php page only the included file is a .html file.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    That should be fine. What do you mean that it 'doesn't work'? What error message(s) do you get? If none, put error_reporting(E_ALL); at the top of your script.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Oct 2008
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    That should be fine. What do you mean that it 'doesn't work'? What error message(s) do you get? If none, put error_reporting(E_ALL); at the top of your script.
    it doesn't apears me nothing. Just watch http://otisweb.uv.ro and watch http://otisweb.uv.ro/Imagini/Funny/Funny.php and you'll see the difference. It doesn't appears me the menu up in the Funny.php page and that black titles which appears only at the index page.

  8. #8
    Join Date
    Oct 2008
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I think the proble is the placement of " because if i write include("../../file.html") the computer consider that ../../file.html is the name of the file not file.html that is 2 directory level up, on root.

  9. #9
    Join Date
    Oct 2008
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I think the problem is the placement of ditto marks because if i write include("../../file.html") the computer consider that ../../file.html is the name of the file not file.html that is 2 directory level up, on root.But if I write include(../../"file.html") don't recognize all the page) what should be the problem

  10. #10
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Error messages:

    Warning: include(f1/f2/meniu-principal.php) [function.include]: failed to open stream: No such file or directory in /home/www/free/uv.ro/otisweb.uv.ro/Imagini/Funny/Funny.php on line 860

    Warning: include() [function.include]: Failed opening 'f1/f2/meniu-principal.php' for inclusion (include_path='.:./inc:/home/www/lib:/home/www/lib/pear:/home/www/lib/pear/DB:/home/www/lib/nusoap:/home/www/lib/phrame:/home/www/lib/toplabs:/allowrun:') in /home/www/free/uv.ro/otisweb.uv.ro/Imagini/Funny/Funny.php on line 860

    This will never be valid (../../"file.html"). It could be ("../../file.html") or (../../file.html) or possibly ("/../../file.html") or (/../../file.html). I'm not that sure or familiar with includes. I'm pretty certain Twey will know though so wait for a response from him or Nile or someone that knows php a bit better. I'm still learning it as well.

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
  •