XF 2.2 Widget abode/below node list issue

FoxSecrets

Active member
I need to show my widget according to certain condition, and using template_modification to make it.

However if I set condition 1 (above), it shows the widget above but also in the bottom (but only the frame, not content, it's buggy).

It seems rendering twice even applied to condition. How can I solve that?


Code:
<xf:if is="condition == 1">
    <xf:widget key="my_widget" />
</xf:if>

<xf:macro name="node_list" arg-children="{$nodeTree}" arg-extras="{$nodeExtras}" />

<xf:if is="condition == 2">
    <xf:widget key="my_widget" />
</xf:if>
 
I had a problem like this with a conditional widget which also appeared empty, a dev replied to me but it is impossible for me to get back into the thread. I don't know if I created the thread or participated in another...
 
This one but not exactly the same issue. Sorry.
 
This one but not exactly the same issue. Sorry.
That's another subject, but thank you anyway, I'll keep trying to find a solution
 
But maybe, as in my case, it would be better to work with widget positions rather than conditions, like in the forum_list template for example?
HTML:
<xf:widgetpos id="forum_list_above_nodes" />
<xf:macro id="node_list" arg-children="{$nodeTree}" arg-extras="{$nodeExtras}" />
<xf:widgetpos id="forum_list_below_nodes" />
 
I don't want to use position because the user has to set it manually, and in my case should load automatically based on conditions. If you have another idea let me know.
 
I just installed XF 2.3 RC5 and the new widgets Medias and Resources Trending were installed automatically... So maybe you would find it convoluted but if the positions were nested by conditions wouldn't that answer your problem?

I'm searching blindly but the subject interests me so...
 
Ya, that's the widget-key currently nested not the widget-position... But it doesn't matter, I don't want to waste your time with solutions that aren't solutions. (y)
 
Got it working now @Old Nick ! Thank you for taking your time to help me!

The condition did work. The problem was the way I did the template modification, I got the tag wrong and left it poorly formed.

At first I grabbed the "node_list" tag, but it appears twice in the template (probably the issue I found). To fix it, I got the above and below tags separately and with the conditions I needed, and now it worked. See what the code looked like:

Template modification above nodes:
Find: #(<xf:widgetpos id="forum_list_above_nodes".*?\/>)#si

Replace:
Code:
$1
<xf:if is="condition== 1">
    <xf:widget key="my_widget" />
</xf:if>

Template modification below nodes:
Find: #(<xf:widgetpos id="forum_list_below_nodes".*?\/>)#si

Replace:
Code:
<xf:if is="condition == 2">
    <xf:widget key="my_widget" />
</xf:if>
$1
 
Back
Top Bottom