SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot Steveiwonder's Avatar
    Join Date
    Nov 2008
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Include, .html file with '

    Hello,

    Simple one but confusing, feel slightly embaressed to ask tbh but oh well.

    I'm using include('/somepath/somefile.html');

    inside somefile.html i have some blurb like this:

    "This is some text which includes a ' some more text... bla bla"

    If i try and include the .html it doesn't include any of the text. However if i remove the ' then it works fine.



    Thanks

    Steve
    Follow the dream, don't chase the competition.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,299
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    That's weird. Sounds like there's more than meets the eye here. All the same, you could perhaps replace the ' with a corresponding entity reference if you want a quick fix: '

  3. #3
    SitePoint Zealot Steveiwonder's Avatar
    Join Date
    Nov 2008
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is weird :P but yeah that's the other option. I have tested it with " & lots of special characters but its only ' that seems to fail.

    Any idea's of what it might be?
    Follow the dream, don't chase the competition.

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,299
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    It's not my area, I'm afraid. All I can think to ask is what happens if you use

    Code:
    include("/somepath/somefile.html");
    (with double quotes), but I'd be surprised if that makes a difference.

  5. #5
    SitePoint Zealot Steveiwonder's Avatar
    Join Date
    Nov 2008
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No worries.

    Still same result.


    Anyone else got any idea's?
    Follow the dream, don't chase the competition.

  6. #6
    SitePoint Evangelist ColinHughes's Avatar
    Join Date
    Sep 2004
    Location
    Spain
    Posts
    473
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does somefile.html actually contain any markup?

  7. #7
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    I think we'd have to see the file you're trying to include to say for certain. Could be a character encoding mismatch to the source you're trying to include from -- could be you've got php in that .html (which WILL execute if you use include)

    Include is for code -- have you tried using readfile instead? Readfile is for when you do not want the possibility of code execution... include/require is for when you want the file (regardless of it's extension) to be checked for and allowed to execute php.

  8. #8
    SitePoint Zealot Steveiwonder's Avatar
    Join Date
    Nov 2008
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am extremely sorry to have wasted your time peeps, it was a stupid mistake.

    Back in the nav i forgot to add an ending ' .

    Again, very sorry.

    But thank you.
    Follow the dream, don't chase the competition.


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
  •