vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Design and Graphics Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=168)
-   -   Different part of the template in specific forum? (https://vborg.vbsupport.ru/showthread.php?t=190475)

nando99 09-09-2008 06:35 PM

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?

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:
HTML Code:

<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

Code:

<if condition="!in_array($foruminfo[forumid], array(103))">
<img src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;stc=1&amp;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]&amp;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]&amp;stc=1&amp;thumb=1&amp;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]&amp;stc=1&amp;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:

HTML Code:

<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:
HTML Code:

<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

Code:

<if condition="$forumid != 103">

<img src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;stc=1&amp;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]&amp;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]&amp;stc=1&amp;thumb=1&amp;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]&amp;stc=1&amp;d=$attachment[dateline]" border="0" alt=""/>
</div>

</if>

Thanks again - have any other ideas?

--------------- 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!

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

Code:

<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:

HTML Code:

<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:

Code:


<img src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;stc=1&amp;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]&amp;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]&amp;stc=1&amp;thumb=1&amp;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....

Code:

<img src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;stc=1&amp;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]&amp;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]&amp;stc=1&amp;thumb=1&amp;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:

HTML Code:

Testing:<br>
1 - $forum[forumid] &nbsp;
2 - $foruminfo[forumid] &nbsp;
3 - $thread[forumid] &nbsp;
4 - $threadinfo[forumid] &nbsp;
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!


All times are GMT. The time now is 09:52 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01197 seconds
  • Memory Usage 1,792KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (5)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (20)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete