Reputation: 19
I am trying to create a conditional statement depending on the value of a custom variable called "pp". However I received this message and my widget cannot be loaded:
The expression 'pp == "left"' is not valid.
This is my code:
<script type='text/javascript'>
var pp = "left";
</script>
<b:loop index='postcont' values='data:posts' var='post'>
<b:if cond= 'pp == "left"'>
<b:include name='leftpost'/>
<b:elseif cond='pp= mid'/>
<b:include name='midpost'/>
<b:else/>
<b:include name='rightpost'/>
</b:if>
</b:loop>
Is there any way to use custom variables inside tag? Or any other option to achieve what I am looking for.
Thank you.
BR.
Upvotes: 1
Views: 691
Reputation: 81
Use b:with tag to define a blogger variable
<b:with var='pp' value='"left"'>
<b:loop index='postcont' values='data:posts' var='post'>
<b:if cond='data:pp == "left"'>
<b:include name='leftpost'/>
<b:elseif cond='data:pp == "mid"'/>
<b:include name='midpost'/>
<b:else/>
<b:include name='rightpost'/>
</b:if>
</b:loop>
</b:with>
Upvotes: 2