XF 2.1 Multiple xf:extension of the same name

Russ

Well-known member
One option in which was used quite often in our styles is essentially shifting the message-attribution bar in the post outside the main post container (to span across the entire message).

Pre-2.2 I simply used a macro along with a conditional to call the macro either in the default position or above the message.

With 2.2, you can't have multiple:

Code:
                            <xf:extension name="attribution">
                                <xf:macro name="post_attribution" arg-post="{$post}" arg-thread="{$thread}" />
                            </xf:extension>
even if it's wrapped in a conditional (at least it's not letting me :D).

Any advice on somehow placing this twice in the template (both being wrapped in a conditional).
 
Solution
Wrap that existing code in your standard conditional. Then, where you want the alternative location to be, do:

Code:
<xf:if is="$otherCondition">
<xf:extensionvalue name="attribution" />
</xf:if>

And that should just work, even in child versions of the template that might manipulate what is within the attribution extension.
Wrap that existing code in your standard conditional. Then, where you want the alternative location to be, do:

Code:
<xf:if is="$otherCondition">
<xf:extensionvalue name="attribution" />
</xf:if>

And that should just work, even in child versions of the template that might manipulate what is within the attribution extension.
 
Solution
Wrap that existing code in your standard conditional. Then, where you want the alternative location to be, do:

Code:
<xf:if is="$otherCondition">
<xf:extensionvalue name="attribution" />
</xf:if>

And that should just work, even in child versions of the template that might manipulate what is within the attribution extension.

Thank you Mike! Works perfectly.
 
Hi

I'm also having problems trying to use multiple xf:extension of the same name in a template modification.

Example:
Code:
<xf:if is="in_array($thread.node_id, {$xf.options.nodesId})">
    <xf:extension name="pinned_block_classes" value="" />
<xf:else />
    <xf:extension name="pinned_block_classes" value="" />
</xf:if>

How can I have them both?
 
Back
Top Bottom