No announcement yet.

Commenting out variables

  • Filter
  • Time
  • Show
Clear All
new posts

  • Commenting out variables

    How do I comment out a variable? For instance, I don't want to use $posticons, but rather than delete it from the template, just in case I want to use it in the future, how do I comment it out?

    I've tried <!--$posticons -->, but that leaves a trailing "-->" on the web page itself. I also tried // and /* */, but they don't work, either. May I have a clue, please?
    ~ Life isn't always fair, but you can be. ~

  • #2
    As a rule of thumb, when commenting out variables, add a space directly after the $

    That way the variable will not get parsed, and thus there is no change the variable will be replaced by text that contains "-->" (which is the cause of it appearing on your site - at least in IE)


    • #3
      Might be just me, but .. isn't this a bug?


      • #4
        Originally posted by Floris
        Might be just me, but .. isn't this a bug?
        I was wondering that myself. One would think that a variable could be commented out. Everything else can, why not the humble variable?

        In any event, I took LeeCHeSSS's advice and put a space after the $. Although this makes it more work when commenting out a block of html that contains multiple variables within it.
        ~ Life isn't always fair, but you can be. ~


        • #5
          You can just remove the varible if you dont want to use it, and for refrense thats what the master template set is for


          • #6
            Not a bug really. Unless you want the template preparser to ignore variables that are between <!-- and -->

            That would only decrease performance significantly.


            • #7
              I understand leeches, but why does it display the --> ? It should 'stop' parsing after the $variable and what you end up with is:

              <!-- start comment
              $variable parsed into <blwegiuehrui3whfwfe>
              end comment -->

              The browser should still not display what is between the <!-- comments --> and not show the --> or the parsed variable in front of it. Something is breaking it I guess.


              • #8
                Indeed, something is breaking: IE

                Try it out: view <!-- <!-- --> --> in IE and in a less aged browser.


                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.