XF 2.1 How can I exclude a nested html tag from <xf:foreach>?

@Russ not quite what I had intended for but I've wrapped my head around enough code to get it working by myself now. No worries. Just needed to see some conditionals like the one you gave me. More than likely I'll be able to get it working. I assume your example was just guidance. I'll update the thread with the working code once I get it :P
 
For anyone interested. This is my final code that works beautifully. Taken from @Russ example.

HTML:
$0

<xf:if is="property('LightSwitch_On') == 'Enabled'">

<xf:if is="{$xf.visitor.style_id} == property('Light_Switch')">
    <a href="{{ link('misc/style', null, {'style_id': property('Dark_Switch'),'_xfRedirect': $xf.fullUri,'t': csrf_token()}) }}">
    <img src="{{ base_url('styles/default/bp/lightswitch/bulb-off.png', true) }}">
           </a>
    </xf:if>
      <xf:if is="{$xf.visitor.style_id} == property('Dark_Switch')">
   
    <a href="{{ link('misc/style', null, {'style_id': property('Light_Switch'),'_xfRedirect': $xf.fullUri,'t': csrf_token()}) }}">
            <img src="{{ base_url('styles/default/bp/lightswitch/bulb-on.png', true) }}">
       
           </a>
</xf:if>


<xf:if is="{$xf.visitor.style_id} == property('Light_Switch2')">
    <a href="{{ link('misc/style', null, {'style_id': property('Dark_Switch2'),'_xfRedirect': $xf.fullUri,'t': csrf_token()}) }}">
        <img src="{{ base_url('styles/default/bp/lightswitch/bulb-off.png', true) }}">
    </a>
</xf:if>
   
    <xf:if is="{$xf.visitor.style_id} == property('Dark_Switch2')">
    <a href="{{ link('misc/style', null, {'style_id': property('Light_Switch2'),'_xfRedirect': $xf.fullUri,'t': csrf_token()}) }}">
        <img src="{{ base_url('styles/default/bp/lightswitch/bulb-on.png', true) }}">
    </a>
</xf:if>

<xf:if is="{$xf.visitor.style_id} == property('Light_Switch3')">
    <a href="{{ link('misc/style', null, {'style_id': property('Dark_Switch3'),'_xfRedirect': $xf.fullUri,'t': csrf_token()}) }}">
        <img src="{{ base_url('styles/default/bp/lightswitch/bulb-off.png', true) }}">
    </a>
</xf:if>
   
    <xf:if is="{$xf.visitor.style_id} == property('Dark_Switch3')">
    <a href="{{ link('misc/style', null, {'style_id': property('Light_Switch3'),'_xfRedirect': $xf.fullUri,'t': csrf_token()}) }}">
        <img src="{{ base_url('styles/default/bp/lightswitch/bulb-on.png', true) }}">
    </a>
</xf:if>

<xf:if is="{$xf.visitor.style_id} == property('Light_Switch4')">
    <a href="{{ link('misc/style', null, {'style_id': property('Dark_Switch4'),'_xfRedirect': $xf.fullUri,'t': csrf_token()}) }}">
        <img src="{{ base_url('styles/default/bp/lightswitch/bulb-off.png', true) }}">
    </a>
</xf:if>
   
    <xf:if is="{$xf.visitor.style_id} == property('Dark_Switch4')">
    <a href="{{ link('misc/style', null, {'style_id': property('Light_Switch4'),'_xfRedirect': $xf.fullUri,'t': csrf_token()}) }}">
        <img src="{{ base_url('styles/default/bp/lightswitch/bulb-on.png', true) }}">
    </a>
</xf:if>

<xf:if is="{$xf.visitor.style_id} == property('Light_Switch5')">
    <a href="{{ link('misc/style', null, {'style_id': property('Dark_Switch5'),'_xfRedirect': $xf.fullUri,'t': csrf_token()}) }}">
        <img src="{{ base_url('styles/default/bp/lightswitch/bulb-off.png', true) }}">
    </a>
</xf:if>
   
    <xf:if is="{$xf.visitor.style_id} == property('Dark_Switch5')">
    <a href="{{ link('misc/style', null, {'style_id': property('Light_Switch5'),'_xfRedirect': $xf.fullUri,'t': csrf_token()}) }}">
        <img src="{{ base_url('styles/default/bp/lightswitch/bulb-on.png', true) }}">
    </a>
</xf:if>

</xf:if>
 
Last edited:
Top Bottom