View Full Version : Different part of the template in specific forum?
nando99
09-09-2008, 06:35 PM
Is there any way to have a different part of a template show depending on the forum?
For example, I'd like to show thumbnails for attached images on most forums, but a specific forum I'd like to show the full attached image. I've already figured out how to do it globally but I'd like to do it per forum. I also know you can use different themes for forums, but I was wondering if it can be done using 1 global theme. Something like, if forum equals #, show this, if else show this...
Is this possible to do in the template files?
Lynne
09-09-2008, 07:10 PM
<if condition="in_array($foruminfo[forumid], array(xx,yy))">
do stuff only in forumid xx and yy
</if>
nando99
09-09-2008, 07:29 PM
Nice! Thanks! How about not to show depending on forum?
And - whats the array for? is that for multiple forums? like <if condition="in_array($foruminfo[forumid], array(12,13))">? So I put nothing as [forumid]?
Sorry, I'm a little slow with this...
THANKS in advance...
Lynne
09-09-2008, 08:17 PM
The array is for multiple forums just as you posted (and your condition is correct for just forums 12 and 13). And yes, leave the $foruminfo[forumid] alone. If you *don't* want it in 12 or 13, then:
<if condition="!in_array($foruminfo[forumid], array(12,13))">
stuff in all forums except 12 and 13
</if>
nando99
09-10-2008, 02:12 AM
Hey - thanks again....
This is my code for template: postbit_attachmentthumbnail
<if condition="!in_array($foruminfo[forumid], array(103))">
<img src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&stc=1&d=$attachment[dateline]" border="0" alt="" style="display:none;"/>
<div style="float:left; display:block; width:111px; height:111px; text-align:center;">
<table cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle" height="111" width="111" style="margin:0px; padding:0px;">
<a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&d=$attachment[dateline]" rel="Lightbox" id="attachment$attachment[attachmentid]"<if condition="$show['newwindow']"> target="_blank"</if>><img class="thumbnail" src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&stc=1&thumb=1&d=$attachment[thumbnail_dateline]" border="0" alt="Click for a bigger size image." align="middle" style="border: solid 3px #cccccc;"/></a></td></tr></table>
</div>
</if>
<if condition="in_array($foruminfo[forumid], array(103))">
<div align="center"><img src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&stc=1&d=$attachment[dateline]" border="0" alt=""/>
</div>
</if>
The code for it NOT to show seems to work since it doesn't show the full image in any forum, but it doesn't show the full image in the post located in the forum with ID 103...
This is the post in the forum with id 103 : http://www.fatboymagazine.com/showthread.php?t=33215
Any idea why its not working? Thanks again!
Lynne
09-10-2008, 02:23 AM
If you are doing this in the postbit, I think you may be able to just use the variable $forumid. And you should combine your conditions:
<if condition="!in_array($forumid, array(103))">
do something
<else />
else do something else
</if>
And, if it is just one single forum, you may want to just go:
<if condition="$forumid != 103">
do something
<else />
else do something else
</if>
nando99
09-10-2008, 11:47 AM
Thanks again... but its still not working... i tried both codes, the one for multiple forums and the one for just one forum... none are working....
http://www.fatboymagazine.com/showthread.php?t=33215
here is new code i have in template postbit_attachmentthumbnail
<if condition="$forumid != 103">
<img src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&stc=1&d=$attachment" border="0" alt="" style="display:none;"/>
<div style="float:left; display:block; width:111px; height:111px; text-align:center;">
<table cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle" height="111" width="111" style="margin:0px; padding:0px;">
<a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&d=$attachment[dateline]" rel="Lightbox" id="attachment$attachment[attachmentid]"<if condition="$show['newwindow']"> target="_blank"</if>><img class="thumbnail" src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&stc=1&thumb=1&d=$attachment[thumbnail_dateline]" border="0" alt="Click for a bigger size image." align="middle" style="border: solid 3px #cccccc;"/></a></td></tr></table>
</div>
<else />
<div align="center"><img src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&stc=1&d=$attachment[dateline]" border="0" alt=""/>
</div>
</if>
Thanks again - have any other ideas?
--------------- Added [DATE]1221060417 at 1221060417 ---------------
I've seen and posted on 1 post about conditional templates in the programming forum - should I have posted this there? I figured it was template orientated it fit well here....
Either way, looking forward to your help again Lynne, I know I must seem like a pain in the butt - thanks again!
Lynne
09-10-2008, 03:43 PM
If I were doing this, this is what I'd do.
First get your condition to work. Just put "Boo" and "Hello" in there to see what get's spit out. That way you may sure "Boo" shows when you are not in forumid 103 and "Hello" shows only in forumid 103.
Then, after I am sure the condition is working, I'd go put the code in there.
nando99
09-10-2008, 03:56 PM
Hey thanks - tried that and the condition doesn't seem to work at all... nothing shows up...
Again, I tried both codes for 1/multiple forums.
here is new code i have in template postbit_attachmentthumbnail
<if condition="!in_array($forumid, array(103))">
testing
<else />
test - humor
</if>
It should show the word "testing" in every forum except 103 where it should show "test - humor". It doesn't show anything at all.
Thanks again.
Lynne
09-10-2008, 04:18 PM
It should show one of those if there is a thumbnail that is supposed to be there. Do this - vboptions > General Settings > Add Template Name in HTML Comments > set to Yes . Then go back to your page and view the source and make sure the template is even being called. If it is, it should be printing one of those words.
edit: I see a thumbnail attachment in the thread you linked to. Did you just revert it?
nando99
09-10-2008, 04:23 PM
Yeah... I reverted it... will do the option changes now
Lynne
09-10-2008, 04:28 PM
OK, you did that. Now, at the *end of the template* (so your thumbnails still are there while you figure this out) put:
<if condition="$forumid != 103">
testing
<else />
test - humor
</if>One of those words should show up.
Another thing to try instead of $forumid is $threadinfo[forumid].
nando99
09-10-2008, 04:32 PM
ok... the words are showing up but the condition itself isn't working...
http://www.fatboymagazine.com/showthread.php?t=32906
It's showing the word testing when it should show the words test - humor.....
this is what my code looks like now after your suggestions:
<img src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&stc=1&d=$attachment[dateline]" border="0" alt="" style="display:none;"/>
<div style="float:left; display:block; width:111px; height:111px; text-align:center;">
<table cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle" height="111" width="111" style="margin:0px; padding:0px;">
<a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&d=$attachment[dateline]" rel="Lightbox" id="attachment$attachment[attachmentid]"<if condition="$show['newwindow']"> target="_blank"</if>><img class="thumbnail" src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&stc=1&thumb=1&d=$attachment[thumbnail_dateline]" border="0" alt="Click for a bigger size image." align="middle" style="border: solid 3px #cccccc;"/></a></td></tr></table>
</div>
<if condition="!in_array($forumid, array(103))">
testing
<else />
test - humor
</if>
Lynne
09-10-2008, 04:37 PM
Try the condition I posted in post 12.
nando99
09-10-2008, 04:41 PM
Just did.... still showing the only the word "testing"
My current code....
<img src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&stc=1&d=$attachment[dateline]" border="0" alt="" style="display:none;"/>
<div style="float:left; display:block; width:111px; height:111px; text-align:center;">
<table cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle" height="111" width="111" style="margin:0px; padding:0px;">
<a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&d=$attachment[dateline]" rel="Lightbox" id="attachment$attachment[attachmentid]"<if condition="$show['newwindow']"> target="_blank"</if>><img class="thumbnail" src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&stc=1&thumb=1&d=$attachment[thumbnail_dateline]" border="0" alt="Click for a bigger size image." align="middle" style="border: solid 3px #cccccc;"/></a></td></tr></table>
</div>
<if condition="$threadinfo[forumid] != 103">
testing
<else />
test - humor
</if>
Again, thanks for your time...
Lynne
09-10-2008, 04:54 PM
OK, it's almost like the forumid isn't available there. Put this at the end:
Testing:<br>
1 - $forum[forumid]
2 - $foruminfo[forumid]
3 - $thread[forumid]
4 - $threadinfo[forumid]
5 - $forumid<br>
If you don't want that showing in the threads, you could put <!-- at the beginning and --> at the end and it will just show in the page source.
nando99
09-10-2008, 05:19 PM
<a href="http://www.fatboymagazine.com/showthread.php?t=33215" target="_blank">http://www.fatboymagazine.com/showthread.php?t=33215</a> - tried it.... nothing showed up....
Lynne
09-10-2008, 06:47 PM
Sorry I missed your reply somehow.
I saw you posted over at vb.com and got told that perhaps $GLOBALS[forumid] will do the trick. Did it?
nando99
09-10-2008, 06:54 PM
That did it!!!
I didn't even know I got a reply over there until I read your post. lol. You are great for helping me, seriously - thank you.
Lynne
09-10-2008, 08:55 PM
Glad you got it to work!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.