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

Conditional for graphic under node description on forum list only?


Well-known member
I'd like to add a sponsor graphic under the node description on the forum home page, for a specific node only, and only to show on the forum list.

If I add an image <img> to the forum description it also shows on the message list for that forum at the top, along with the description, I don't want this.

So I guess I need to edit the home page forum list template and add, between the node description and the node stats, something along the lines of:

If this is the forum home page AND the node ID = X, then display some html.

The html will be an iframe, since I want to run some banner rotations there.

Can someone please translate the above conditional into actual <xen> code please?



Well-known member
<xen:if is="{$controllerName} == 'XenForo_ControllerPublic_Forum' AND {$controllerAction} == 'index' AND {$node} == 'x'> CODE </xen:if>
In theory should work though I haven't tested it


Well-known member
I'm afraid that didn't work Cezz, but it was sort of close enough for me to reverse engineer and fix it :)

I didn't need to check for being on the forum home page in the end, since I was directly editing the node_forum_level2 template, and that only appears on the forum list anyway. After {xen:raw $forum.description} I used the following:

<xen:if is="{$forum.node_id}==X"> my code </xen:if>
Replacing X with the node ID.

This now puts a nice randomly chosen banner under the forum description (via an iframe) :)

I must thank XenFans - that conditional is from their excellent template conditionals guide.


Well-known member
I just want to expand on this if I may, in case any other newbies would like to stick a nice graphic banner under the forum description of a particular forum on their home page.

The "my code" in the above example is an insertion of an iframe, as this is a shortcut to sticking anything you like in the forum, here because it is a random image generated by a PHP file and it means I don't need to try and figure out a plugin or other mysterious things. So the code I inserted above is:

<div class="banner"><iframe frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="advert.php" width="300px" height="50px" border="0"></iframe></div>
In extra CSS you can then add some CSS for the banner, in this case just to give some space top and bottom:

.banner {
margin-top: 5px;
margin-bottom: 5px;
And advert.php is my own script cobbled together which just displays a random banner graphic (with link) from a pre-determined selection of banners (basically it picks a random number between 1 and the number of banners available, then inserts X.php, with X.php being, for example 1.php or 2.php etc and those files contain a graphic banner and link and any thing else required for that advert). Quite belt and braces and basic but it works.