Forums

[resolved] PHP Comments Appearing in Webpage (7 posts)

  1. rmarce
    Member
    Posted 1 year ago #

    I am writing my index.php and header.php etc. files for the first time, but when I go to preview my website, the comments are appearing in the body of the webpage. My code looks like this:

    /*
    This is the header of all your HTML code. It is only done once for your entire website.
    You can think of this as the prologue to a book.
    */

    // TELLS HTML HOW TO INTERPRET YOUR CODE
    // - Use "strict" over "transitional" for better website efficiency and performance

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    Since this is PHP, I am using /* */ and // to make comments. However, I noticed that the HTML comments <!-- --> do not appear.

    Why are my PHP comments not working correctly? I've looked at other templates, and they all use the same coding symbols that I use.

  2. stvwlf
    Member
    Posted 1 year ago #

    Perhaps your PHP section is not wrapped in the PHP start and end tags

    <?php at the beginning
    and ?>
    at the end

  3. 123milliseconds
    Member
    Posted 1 year ago #

    Link to page so we can look ?

  4. rmarce
    Member
    Posted 1 year ago #

    Thanks stvwlf! I'm new to the language, so I didn't realize that I needed to wrap it --- I thought because the file was saved as a .php, it was automatically interpreted that way, not as html.

  5. 123milliseconds
    Member
    Posted 1 year ago #

    Please mark thread as resolved ??? so that

    - others with similar problem can see it as resolved and will read this thread for help if they have similar problem

    - people providing help see it as resolved and will not waste time reading this post.

  6. rmarce
    Member
    Posted 1 year ago #

    I already did =)

  7. 123milliseconds
    Member
    Posted 1 year ago #

    sorry

Topic Closed

This topic has been closed to new replies.

About this Topic