Fork me on GitHub

tip : if IE in a template  Bottom

  • When debugging your template in order to make it compatible with IE, you will probably have to use the if IE tags.

    By default, when you add a tag "if IE", it's considered as a Zikula tags.

    Code

    <!--[if IE]-->


    In order to avoid this, use the Smarty "litteral".

    Code

    <!--[literal]-->
        <!--[if IE]-->
          <p >Sorry this design is not compatible with IE</p>
        <![endif]-->
        <!--[/literal]-->


    http://www.smarty.net/manual/en/language.function.literal.php
  • See also this topic: http://community.zikula.org/module-Forum-viewtopic-topic-54366.htm for a more elegant way of putting this nicely in the header of the HTML doc.

    --
    campertoday.nl, Module development, Dutch Zikula Community
  • These need to straight in to the Wiki, not just a link to the thread in Wiki, link to it for discussion of the topic maybe, but the actual content should be in the Wiki for sure, that way if the info changes or is wrong, it can be updated directly by the users, not potentially buried in what could become a long discussion.

    --
    Home Page | Find on Facebook | Follow on Twitter
  • True, I see a volunteer icon_wink



    edited by: espaan, datetimebrief

    --
    campertoday.nl, Module development, Dutch Zikula Community
  • Is literal the best way to comment out a section of Smarty code?

    --
    Damon
    Catamaran Sailing at TheBeachcats.com
  • Commenting out Smarty code can be done by adding an asterixes after the opening bracket and before the closing bracket.

    Code

    < ! - - [* you smarty stuff here *] - - >


    --
    campertoday.nl, Module development, Dutch Zikula Community
  • espaan

    Commenting out Smarty code can be done by adding an asterixes after the opening bracket and before the closing bracket.

    Code

    < ! - - [* you smarty stuff here *] - - >


    I've seen that in the templates for inserting comments, but when I tried using it to "comment out" a section of Smarty code I get a Blank Page when that template is used.

    Example if I want to temporarily comment out the edit links in a news article I would try

    Code

    <!--[* remove this section of smarty code
    <!--[nocache]-->
    <div id="news_editlinks"><!--[articleadminlinks sid=$info.sid]--></div>
    <!--[if $enableajaxedit]-->
    <div id="news_editlinks_ajax" class="hidelink"><!--[articleadminlinks sid=$info.sid page=$page type='ajax']--></div>
    <!--[/if]-->
    end of section that is removed *]-->


    Since that does not work, is there another way?



    edited by: damon, datetimebrief

    --
    Damon
    Catamaran Sailing at TheBeachcats.com
  • Damon,

    Commenting out code in templates using Smarty comments has worked flawlessly for me. I have, like you, run into situations where I've gotten a Blank Page when I've done that. Usually it's been because I've unbalanced something that Smarty needs either opened or closed.

    For example, in your example above you've captured an opening nocache with the Smarty comment. There's likely a closing /nocache somewhere else in the template. If the opening nocache is commented out and Smarty runs into a closing /nocache, it will likely generate an error. Same goes for if, section, foreach, and anything else that creates a Smarty block.

    Usually, if you can set the debug and/or error_reporting levels appropriately and then look into the error logs (or emitted error messages on screen), you can usually find out what Smarty is complaining about.



    edited by: rmburkhead, datetimebrief

    --
    - Robert

    Ohloh profile for Robert Burkhead

    Stack Overflow profile for RobertB at Stack Overflow, Q&A for professional and enthusiast programmers
  • Thanks rmburkhead, that makes sense, I actually did leave out the closing nocache in my example. It hadn't occurred to me that a stray closing tag would do any damage.

    Code

    <!--[nocache]-->
    <div id="news_editlinks"><!--[articleadminlinks sid=$info.sid]--></div>
    <!--[if $enableajaxedit]-->
    <div id="news_editlinks_ajax" class="hidelink"><!--[articleadminlinks sid=$info.sid page=$page type='ajax']--></div>
    <!--[/if]-->
    <!--[/nocache]-->


    Also I'm realizing that, just like HTML comments, if i tried to comment out a section of Smarty code that already included a comment, the existing comment close would screw it up.

    --
    Damon
    Catamaran Sailing at TheBeachcats.com

This list is based on users active over the last 60 minutes.