• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Only execute callback2 if callback1 doesn't return content?

Marcus

Well-known member
#1
Addon2 should only be executed if Addon1 does not output content. How could I do that with Template Modification Replace:
Code:
<xen:include template="ad_forum_view_above_thread_list" />
with execution order 10
Code:
$0
<xen:callback class="Addon1_Callback_ForumView" method="getForumView"
params="{$forum}" />
with execution order 20
Code:
$0
<xen:callback class="Addon2_Callback_ForumView" method="getForumView"
params="{$forum}" />
How can I do that? Is that possible with hasContent or xen:set?
 
Last edited:

Snog

Well-known member
#2
I know this is not what you want to hear, and it's slightly off topic, but you do realize that by using the Template Modification system your mod won't work with any custom templates that someone might create don't you?

In this case, IMHO you're better off using a listener and adding your info to the contents of the template. That way so long as any custom template includes the ad_forum_view_above_thread_list template your mod will work with that custom template.
 

Marcus

Well-known member
#3
The $0 takes care the template is still there.

Does anyone know how to solve that problem? I thought of returning xen:set $addon1output=1 but it will be parsed only after the second addon is executed.
 

Chris D

XenForo developer
Staff member
#5
Something like this, maybe:

Code:
<xen:set var="$addOn1">
    <xen:callback class="Addon1_Callback_ForumView" method="getForumView" params="{$forum}" />
</xen:set>

{xen:raw $addOn1}

<xen:if is="{$addOn1}">
    <xen:callback class="Addon2_Callback_ForumView" method="getForumView" params="{$forum}" />
</xen:if>