Inside comment tags...

8 replies
Quick question:

Does a php "snippet" get seen, thus processed, when inside of html comment tags?

Such as this:
Code:
<!-- 
some text, images, what-not
<? php snippet ?>
more text, etc... 
-->
Thanks, and...

Be Well!
ECS Dave
#comment #inside #tags
  • No, it doesnt.
    {{ DiscussionBoard.errors[3548975].message }}
  • Profile picture of the author SteveJohnson
    Yes, it most certainly does.

    The output, if any, won't be shown in the browser window because it's within the HTML comment tags, but can be seen in the page source.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[3550556].message }}
  • Profile picture of the author IM Business
    If that php is parsed by the server, then there will be nothing there. If the php is not parsed, it will show up inside the comment but not visible in the browser.
    {{ DiscussionBoard.errors[3550603].message }}
    • Profile picture of the author RyanAndrews
      It's almost best in all circumstances to use PHP comments. Why would you want to send this stuff to all users anyway.

      <?php
      /*
      some text, images, what-not
      php snippet
      more text, etc...
      */
      ?>
      {{ DiscussionBoard.errors[3552439].message }}
  • Profile picture of the author Jim Westergren
    processed - yes
    get seen - depends if there is any output such as echo, print etc.
    Signature

    Jim Westergren
    JimWestergren.com | TodaysWeb

    {{ DiscussionBoard.errors[3552911].message }}
    • Profile picture of the author ECS Dave
      Originally Posted by SteveJohnson View Post

      Yes, it most certainly does.

      The output, if any, won't be shown in the browser window because it's within the HTML comment tags, but can be seen in the page source.
      Originally Posted by Jim Westergren View Post

      processed - yes
      get seen - depends if there is any output such as echo, print etc.
      Thanks guys...

      The one line "snippet" was calling a function, that I didn't want called, so I simply
      deleted it, instead of leaving it in the commented html code on the page.

      Be Well!
      ECS Dave
      {{ DiscussionBoard.errors[3558289].message }}
  • Profile picture of the author ECS Dave
    Thanks everyone!

    I had thought that "hiding" something in the html comment tags would not only hide what was between them, but not process it. I see I was mistaken, and have since fixed the issue that drove me to ask...

    Be Well!
    ECS Dave
    {{ DiscussionBoard.errors[3555422].message }}
    • Profile picture of the author oknoorap
      no it doesn't , but please use

      PHP Code:
      <?php
      // comment in one line
      /*
      multiple
      line
      */
      ?>
      in php.

      thats called scalable programming rule.
      {{ DiscussionBoard.errors[3556472].message }}

Trending Topics