PDA

View Full Version : if condition in the header template


ohadpartuck
06-09-2012, 04:48 PM
hi there,
I'm trying to display(or not display a button in my site).
I have located the button in the header template

<vb:if condition="$display_sos"><button id="button_grdient">S.O.S</button></vb:if>

when I do this
<vb:if condition="1"><button id="button_grdient">S.O.S</button></vb:if>
it gets displayed so the condition is ok .

the plugin who's responsible to deliver the variable is (under global_start):
$display_sos = 1;
vB_Template::preRegister('header',array('display_s os' => $display_sos));

i also tried this
<vb:if condition="{vb:raw $display_sos}"><button id="button_grdient">S.O.S</button></vb:if>
but got an error.

any ideas??
:D

kh99
06-09-2012, 05:26 PM
Try your original code (that last example isn't right), but try using hook parse_templates for your plugin.

ohadpartuck
06-09-2012, 07:56 PM
kh99 , you're the man!