PDA

View Full Version : Identifying the forum a thread lives in using <if condition>


VVV Mars VG
12-03-2009, 06:01 PM
Does anyone know if there is a way to identify the Forum for which a thread belongs to so that I can give a set of threads a custom style without using a seperate style sheet and attaching it to a forum group.

Thats how I've done it in the past, but it becomes a bit messy if things change down the line.

Essentially I have a News forum with several sub forums, every thread within news needs to look different to the threads on the rest of the site.

kh99
12-03-2009, 06:26 PM
I think it might depend on what php file is being displayed. Do you know what php code is actually printing out your news threads?

VVV Mars VG
12-03-2009, 06:32 PM
I'm not sure what you mean by that? the url that shows in the address bar doesn't have any reference to parent forums.

kh99
12-03-2009, 06:36 PM
The variables that are available to test in the template "if" condition are set in the php code. I looked at showthread.php and noticed that $post has a lot of the thread info but doesn't have the forums id. The forum id seems to be in $thread['forumid']. But that's when the url is 'showthread.php', so you could try that but it might not work for you if the page is not showthread.php.

VVV Mars VG
12-04-2009, 06:14 PM
Not sure what to do with that but I'll give it a try – thanks.

Lynne
12-04-2009, 06:16 PM
What he's basically asking is what page (or template) are you trying to do the conditon in? The page, and template, will define what the name of the variable to use should be.

VVV Mars VG
12-05-2009, 02:41 PM
I've got this working in showthread.php

<if condition="$forum[forumid] == 104"><div id="article"></if>

I can't however get this working for multiple forumids

<if condition="$forum[forumid] == 104 OR 25 OR 35"><div id="article"></if>

I will also need to do this on forumdisplay.php but I haven't got to that bit yet.

Thanks for the help so far, its making things alot easier.

Lynne
12-05-2009, 04:12 PM
<if condition="in_array($forum['forumid'], array(104, 25, 35))"><div id="article"></if>