Is this right coding?

Discussion in 'PHP' started by tptnyc, Aug 29, 2008.

  1. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #21
    ah. well it seems that the footer.php file either doesnt exist at all, or at least not in the same directory as your index.php file
     
    JAY6390, Aug 29, 2008 IP
  2. tptnyc

    tptnyc Peon

    Messages:
    764
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #22
    Well, you guys all said the coding is ok now for footer.php.
    Then I created footer.php file in public_html/includes.
    Thereafter I placed in the index.php like this:
    <div id="footer"/>


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

    </div>

    </body>
    </html>

    SO where is the mistake now?
     
    tptnyc, Aug 29, 2008 IP
  3. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #23
    Just because you have a folder called includes does not automatically mean you can include files from that directory...where you have
    include("footer.php");
    PHP:
    change it to
    include("includes/footer.php");
    PHP:
     
    JAY6390, Aug 29, 2008 IP
  4. tptnyc

    tptnyc Peon

    Messages:
    764
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #24
    Thanks Jay6390.Finally it came right.
    But here is my another query, the footer.php file shows:
    File Type: ISO-8859 text instead of File Type: PHP script text

    Is that a problem? If I wrap up the entire coding in block
    <?php
    entire footer coding.......blah blah..
    ;?>

    The file turns into PHP script text of course but on index page I get the following error:

    Parse error: syntax error, unexpected '<' in /home/pri/public_html/lovelytoys/includes/footer.php on line 3
     
    tptnyc, Aug 29, 2008 IP
  5. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #25
    Don't put stuff in the <?php ?> tags unless you know what you are doing. that error is because you have just thrown in stuff between the tags
     
    JAY6390, Aug 29, 2008 IP
  6. tptnyc

    tptnyc Peon

    Messages:
    764
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #26
    Alright, I got it.
    But footer.php file showing as:

    File Type: ISO-8859 text instead of File Type: PHP script text

    Is that Ok?
     
    tptnyc, Aug 29, 2008 IP
  7. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #27
    Yes. See http://en.wikipedia.org/wiki/ISO_8859 if you need more info
     
    JAY6390, Aug 30, 2008 IP
  8. imphpguru

    imphpguru Active Member

    Messages:
    439
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #28
    hey!!
    That is wrong. You dont need "<?php" for that. Also, the links should be before </div> or </body>
     
    imphpguru, Aug 30, 2008 IP