Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: php include problem

  1. #11
    Join Date
    Aug 2008
    Location
    Smiths, AL
    Posts
    164
    Thanks
    30
    Thanked 5 Times in 5 Posts

    Default

    Why don't you just rename the html file with a php extension?

    Try this also...

    You have
    <div id="Layer60"><?php include('../../meniu-principal.html'); ?></div>

    make it:
    <div id="Layer60"><?php include("../../meniu-principal.html"); ?></div>

    Single quotes from my understanding are used to display a literal. Because you are trying to include a page I would think you want to use double quotes.
    Last edited by Dirt_Diver; 01-14-2009 at 03:05 AM.

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

    Default

    No, include(../../file.html) isn't valid either. Syntactically, include() is just a function to which you pass the path to the include, as a string. Strings must always be wrapped in quotation marks (PHP does make an exception for undefined constants, but you shouldn't rely upon it).

    According to these errors you're doing include('f1/f2/meniu-principal.php'), not include('../../file.html').

    Single quotes are used to express a literal string — no special operations will be performed on it, like escape code interpretation or variable interpolation. "$a\n" contains the value of the variable $a followed by a newline, but '$a\n' contains a dollar sign, the letter 'a', a backslash, and the letter 'n'. It's faster, so it should be used where no fancy stuff is required.

    You should also note that your site's code breaks an awful lot of good Web development practices.
    Last edited by Twey; 01-14-2009 at 07:12 AM.
    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!

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

    Default

    can be the problem that the version of php that hosting company uses is older?

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

    Default

    No. PHP has supported include() pretty much forever.
    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!

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
  •