vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   vBulletin Template Conditionals (https://vborg.vbsupport.ru/showthread.php?t=215032)

|Jordan| 01-13-2012 08:22 PM

Thanks for the fix, but it doesnt work :( I changed the code to make testing have less variables

Quote:

<if condition="$show['newthreadlink'] && $forum['forumid'] == 8"><a href="complaints-suggestions.php" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a><else /><a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a></if>
I applied it to forumdisplay and the new thread button still displays with the default newthread url even in the forum i dont want it to display in.

HMBeaty 01-14-2012 02:47 AM

Try this: (sometimes && doesn't doesn't play well in templates)
HTML Code:

<if condition="$show['newthreadlink'] AND $forum['forumid'] == 8">
    <a href="complaints-suggestions.php" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a>
<else />
    <a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a>
</if>


TheLastSuperman 01-14-2012 04:36 AM

Quote:

Originally Posted by HMBeaty (Post 2287518)
Try this: (sometimes && doesn't doesn't play well in templates)
HTML Code:

<if condition="$show['newthreadlink'] AND $forum['forumid'] == 8">
    <a href="complaints-suggestions.php" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a>
<else />
    <a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a>
</if>


OR

HTML Code:

<if condition="$show['newthreadlink'] AND $thread['forumid'] == 8">
    <a href="complaints-suggestions.php" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a>
<else />
    <a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a>
</if>

Replacing $forum with $thread but I believe either should work fine it's vB4 that does not get along with $forum being used within showthread and other if I'm remembering correctly so why we use thread in that situation.

|Jordan| 01-14-2012 05:02 AM

Quote:

Originally Posted by HMBeaty (Post 2287518)
Try this: (sometimes && doesn't doesn't play well in templates)
HTML Code:

<if condition="$show['newthreadlink'] AND $forum['forumid'] == 8">
    <a href="complaints-suggestions.php" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a>
<else />
    <a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a>
</if>


That didnt work either :(

@TheLastSuperman, this is for VB3.

BirdOPrey5 01-14-2012 10:00 AM

If you search the template you are putting the custom code in, look at what variable names are already being used.

In showthread $forum is never used... Nor is $thread, the actual one used is $threadinfo.

In forumdisplay it's $foruminfo....

So for the forumdisplay template this would be the code:

PHP Code:

<if condition="$show['newthreadlink'] AND $foruminfo['forumid'] == 8">
    <
a href="complaints-suggestions.php" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]border="0" /></a>
<else />
    <
a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]border="0" /></a>
</if> 


|Jordan| 01-14-2012 07:20 PM

OMG THAT WORKED!

Thank you Thank you! THANK YOU!

kpmedia 03-24-2012 09:14 AM

Quote:

Originally Posted by nquang (Post 2083497)
Is there a variable for which member create thread??

Late reply, but had the same question myself. (At least I think it's the same question.)
Looked in the db, read some docs, and got it right on the first try. :)

Code:

<if condition="$thread[postuserid] == 15">
CODE
</if>

Where "15" is the user in the code example.

Code added to the template could show a message to members/guests (unless further limited by more conditionals), in posts created by this specific thread starter. For example, to add a unique secondary signature by an admin in new threads. You can hard code the message, or add a new phrase variable.

###

ttaspinar 04-03-2012 03:46 PM

thanks.

MRGTB 06-10-2012 09:43 AM

Quote:

Originally Posted by BirdOPrey5 (Post 2138153)
Actually that is_member_of is a function specific to usergroups...

In general to do this for arrays it would be:

Code:

<if condition="in_array($forum[forumid], array(2, 3, 4, 5, 6 )">
and for !=

Code:

<if condition="!in_array($forum[forumid], array(2, 3, 4, 5, 6 )">

Your missing an extra closing bracket there.

Code:

<if condition="in_array($forum[forumid], array(2, 3, 4, 5, 6 ))">
and for !=

Code:

<if condition="!in_array($forum[forumid], array(2, 3, 4, 5, 6 ))">

BirdOPrey5 06-10-2012 11:08 AM

Thanks. Updated original post. :up:


All times are GMT. The time now is 10:21 AM.

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.01421 seconds
  • Memory Usage 1,766KB
  • 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
  • (4)bbcode_html_printable
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete