The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Different part of the template in specific forum?
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? |
#2
|
||||
|
||||
<if condition="in_array($foruminfo[forumid], array(xx,yy))">
do stuff only in forumid xx and yy </if> |
#3
|
|||
|
|||
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... |
#4
|
||||
|
||||
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:
HTML Code:
<if condition="!in_array($foruminfo[forumid], array(12,13))"> stuff in all forums except 12 and 13 </if> |
#5
|
|||
|
|||
Hey - thanks again....
This is my code for template: postbit_attachmentthumbnail Code:
<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> 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! |
#6
|
||||
|
||||
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:
HTML Code:
<if condition="!in_array($forumid, array(103))"> do something <else /> else do something else </if> HTML Code:
<if condition="$forumid != 103"> do something <else /> else do something else </if> |
#7
|
|||
|
|||
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 Code:
<if condition="$forumid != 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> <else /> <div align="center"><img src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&stc=1&d=$attachment[dateline]" border="0" alt=""/> </div> </if> --------------- Added [DATE]1221060417[/DATE] at [TIME]1221060417[/TIME] --------------- 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! |
#8
|
||||
|
||||
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. |
#9
|
|||
|
|||
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 Code:
<if condition="!in_array($forumid, array(103))"> testing <else /> test - humor </if> Thanks again. |
#10
|
||||
|
||||
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? |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|