if statement - Blogger: Implementing a simple IF with an OR in the condition -
in blogger template have following code:
<b:if cond='data:blog.pagetype == "index"'> <!-- lot of lines of code --> </b:if> <b:if cond='data:blog.pagetype == "archive"'> <!-- same lines of code --> </b:if>
it possible merge both 'if's in unique expresión?. using simple logical or?. i've tried following no result:
<b:if cond='data:blog.pagetype == "index" || data:blog.pagetype == "index"'> <b:if cond='data:blog.pagetype == "index" || data:blog.pagetype == "index"'> <b:if cond='data:blog.pagetype == "index" or data:blog.pagetype == "index"'> <b:if cond='data:blog.pagetype == "index" || "index"'> <b:if cond='data:blog.pagetype == "index" || "index"'>
note: | html expression '|'.
i google no result, , reviewed blogger b:if statement, found no answer simple question.
----- edited -----
the desired result having code like:
<b:if cond='data:blog.pagetype == "index"' || cond='data:blog.pagetype == "archive"'> <!-- lot of lines of code --> </b:if>
in way, don't repeat block 'lot of lines of code', resulting more maintainable code, , simplier.
anyway, knowing how simple or thing furure cases.
to simulate or operator in blogger template, use in operator.
in case:
<b:if cond='data:blog.pagetype in {"index","archive"}'> <!-- block run when pagetype index or archive--> </b:if>
Comments
Post a Comment