XF 2.2 Condition to show ads in specific nodes and their children

Kirby

Well-known member
I would like to show an ad on position Thread view: Above message list - but only in specific nodes (10, 20, 50) including their children.

I could do this with
Code:
<xf:set var="$nodeIds" value="{{ array_keys($thread.Forum.Node.breadcrumb_data) + [$thread.node_id] }}" />
<xf:if is="in_array(10, $nodeIds) || in_array(20, $nodeIds) || in_array(50, $nodeIds)">Advert in Node IDs 10, 20 and 50 and their children</xf:if>

But this feels really awkward & kinda inefficient.

Does anybody have an idea for a better aproach without Class Extensions & Code Event Listeners @Chris D @Jeremy P ?
 
In my current test bed I am learning with I have achieved this by using the 'Notices' feature to display ads in specific nodes.

Not sure why the Ads feature isn't as customisable as the Notices one?
 
Back
Top Bottom