Log in

View Full Version : Can you use if/then forumhome conditionals in the category descriptions?


rrr
03-12-2012, 11:05 PM
I'm trying to make a banner show in each forum category on the forumhome homepage, but not on the thread view pages or showthread pages.

I tried using
<if condition="THIS_SCRIPT = index">

But that didn't seem to stop it from showing on showthread (didn't seem to take any effect).

Is there a type of conditional that can work within the category descriptions that for sure accept HTML? That's where I'm putting my banner code.

kh99
03-12-2012, 11:14 PM
The condition you posted should be:

<if condition="THIS_SCRIPT == 'index'">


but I don't know if that will solve your problem.

Simon Lloyd
03-13-2012, 07:39 AM
To show it everywhere BUT showthread<if condition="THIS_SCRIPT != 'showthread'">

rrr
03-13-2012, 03:48 PM
Thanks @kh99 and @simon lloyd

I think the problem may be that conditionals aren't parsed in the "description" area of forums. It seems like you can put HTML there, but the conditionals don't seem to be doing anything.

Are conditionals supposed to work in that area?

Simon Lloyd
03-13-2012, 04:27 PM
You would then need to edit the forumbit templates, search for "Description" and you'll see something like<if condition="$show['forumdescription']">
<div class="smallfont">$forum[description]</div>
</if>
and you want to surrond that with your condition like<if condition="THIS_SCRIPT != 'showthread' AND $show['forumdescription']">
<div class="smallfont">$forum[description] <img src="/images/misc/MYADBANNER.gif" /></div>
</if>
<else />
<if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div>
</if>
</if>
Or something like that. you can use html in the description as i just added a picture to one of mine, when i have time i'll see what else we can use for a condition :)

rrr
03-13-2012, 04:40 PM
Thank you!

That seems like it could work for one image, but what I'm trying to do is show a category sponsor banner on the homepage category listing, but not show that banner on the showthread or forumdisplay pages.

I *do* want to show the forum description on the forum display, showthread and forumhome, but *only* show the sponsor banner on forumhome.

The code above looks like it would add the same banner to all the forum categories.

When I'm looking at the forumbit templates, they don't seem to have a forumid in them.

I probably should've put all this info in my original post, but I didn't want to overload it with words :)

Simon Lloyd
03-13-2012, 04:43 PM
You need to look harder :) in forumhome_forumbit_level1_nopost i found <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">$forum[title]</a>
I haven't checked the others but you can build conditionals in to there to show a different image for each forumid ;)

rrr
03-13-2012, 09:30 PM
Thanks again. I think I've almost wrapped my head around it.

So I edit the forumbit template where the $description variable is and add the banner code after that.

I just need to figure out how to write the conditional to show a different image for each forumid.

I tried:
<if condition="$forum[forumid] = '17'">

But that still showed the banner after every forum description instead of next to just forumid 17's forum description.

--------------- Added 1331687984 at 1331687984 ---------------

Hmmm, from the looks of this post from Lynne
https://vborg.vbsupport.ru/showpost.php?p=2038161&postcount=15

It doesn't look like a forumid conditional won't work on forumhome?

--------------- Added 1331689441 at 1331689441 ---------------

My bad, I found my error. I thought != meant "does not equal" and = meant "equal".

Turns out it should have been == which actually means "equal"

<if condition="$forum[forumid] == '17'">

That works on forumhome for only showing a banner on a specific forum category :)

Thanks again @Simon

Simon Lloyd
03-14-2012, 06:55 AM
Glad your sorted :)