PHP Comments

Discussion in 'Web Design and Development' started by AFPoster, Dec 24, 2012.

  1. macrumors 65816

    Joined:
    Jul 14, 2008
    Location:
    Charlotte, NC
    #1
    So I'm attempting to add comments around certain lines of code in my Index.php file and for some reason they're still showing on my site. Any help would be greatly appreciated, code is below:

    PHP:
    /* This button to be hidden for now
    <a class="btn btn-warning" href="#">Hello</a>
    don't remove until proper approval */
    I've also tried:

    PHP:
    #This button to be hidden for now <a class="btn btn-warning" href="#">Hello</a>
    Making sure this one is all on 1 line.
     
  2. macrumors 6502

    Joined:
    Jan 27, 2009
    #2
    Make sure PHP is enabled on your site.
    Code:
    <?php
    	phpinfo();
    ?>
    
     
  3. macrumors 604

    Jessica Lares

    Joined:
    Oct 31, 2009
    Location:
    Near Dallas, Texas, USA
  4. thread starter macrumors 65816

    Joined:
    Jul 14, 2008
    Location:
    Charlotte, NC
    #4
    Thanks for the comments, already figured it out:

    PHP:
    <!--message here-->
     
  5. macrumors 65816

    Joined:
    Jun 18, 2010
    #5
    Just a point of clarification.

    The comments shown in your first post are PHP and the one in your last post is HTML.

    I know you have already answered your own question. I'm just pointing this out because understanding the difference might save you some time in the future. They way PHP and HTML can be mixed on a page can make it difficult to follow what is going on.
     
  6. macrumors 6502

    Joined:
    Mar 7, 2009
    #6
    Those are HTML comments...
     
  7. macrumors 68020

    Comeagain?

    Joined:
    Feb 17, 2011
    Location:
    Spokane, WA
    #7
    //comment in PHP (inside the <?php ?> tags)
    #Comment in .htaccess
    <!-- Comment in HTML -->
     
  8. thread starter macrumors 65816

    Joined:
    Jul 14, 2008
    Location:
    Charlotte, NC
    #8
    Thanks for this! I have to adjust my .htaccess file so this is perfect.
     
  9. macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #9
    One clarification, while inside PHP tags <?php and ?> there are two approaches:

    PHP:
    // to comment current single line only like this one.
    PHP:
    /* 
    To add a multiline comment as
    big as you need.
    */
     

Share This Page