1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Include syntax

Discussion in 'PHP' started by -=adi=-, May 18, 2005.

  1. #1
    Hi.
    I wish to redesign my site and wish to use php for some parts.

    I wish to use include function for this:

    <?php include("menu.php"); ?>

    Now i have the html template and when i add this function (the .html is renamed as .php to be parsed) i get a blank page.

    (menu.php exists and it is in the same directory as the template page page)

    What can be the problem ?
     
    -=adi=-, May 18, 2005 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can your server / hosting deal parse php?
     
    T0PS3O, May 18, 2005 IP
  3. -=adi=-

    -=adi=- Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, running www. mysite.com/menu.php show what should be included in the let's call it index.php page.

    But runing index.php it provides a blank page.
     
    -=adi=-, May 18, 2005 IP
  4. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #4
    We'll need to see exact code and urls to help you.
     
    T0PS3O, May 18, 2005 IP
  5. -=adi=-

    -=adi=- Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I've found one strange thing.

    The index.html works fine but if i rename it to index.php (to be parsed and to use include function) it didn't work.

    So the problem is more related to renaming index.html to index.php

    To see if this is a problem i've chunked the code to found the problem and i've discovered that the first line of the index.html was the problem.

    The first line said: <?xml version="1.0" encoding="iso-8859-1"?>

    After removing it, and renaming html => php, index.php works fine.

    And it works fine also with include function, so the problem is solved.

    Thanks for your reply, it helped me indirectly to solve the problem. :)

    Still one question. Is the line that I've removed important, or I can forget about it ?
     
    -=adi=-, May 18, 2005 IP
  6. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #6
    It probably means that php short tags is enabled so it sees <?xml and starts parsing it as php but version= isn't correct php syntax so it fails.

    Without that line you might not validate W3-wise but your site should be fine in terms of functionality and spidering.

    You could solve it by echoing that line in PHP so it's not parsed.
     
    T0PS3O, May 18, 2005 IP
  7. -=adi=-

    -=adi=- Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Aha. Thanks :)
     
    -=adi=-, May 18, 2005 IP