vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   vB4 Template Conditionals List (https://vborg.vbsupport.ru/showthread.php?t=231525)

princeedward 03-04-2010 08:24 AM

:erm: errrmmm... hi

how about showing something here to a thread starter but not to his first post....is there any conditional on this please?

appreciate any help

thanks and best regards...

:p

hatchet 03-06-2010 10:47 PM

Is there anything that I can pull the date of the last post of a thread?
$thread['lastpostdate'] or something like that. I'm trying to see if the last post date is older than 90 days and if so - output a custom phrase.
Thanks.

boatdesign 03-11-2010 05:54 AM

I'm trying to use a conditional to color code certain forums in the What's New and Search Results.

In search_threadbit I've tried the following, with no success (only the else shows for threads in these forums too.)
Code:

<vb:if condition="in_array($foruminfo[forumid],array(26,29,56,25,27))">
<div class="threadpostedin td alt">
<p>Test Different Color Div will go here For these Forums</p>
</div>
<vb:else />
<div class="threadpostedin td alt">
<p>
{vb:rawphrase forum}: <a href="{vb:link forum, {vb:raw thread}, null, 'forumid', 'forumtitle'}" title="{vb:raw thread.forumtitleclean}">{vb:raw thread.forumtitle}</a>
</p>               
</div>
</vb:if>

I thought that since forumid is actually in the link, it would be a piece of cake, but it's a no go as above. I must be missing something obvious.

I read here about assigning a variable to a template, so tried creating a new plugin to do so, but can't seem to make that work either. One question is that the template is labeled search_threadbit but that's not a choice in the add plugin screen for a hook location - only search_results_threabit which doesn't seem to exist as a template. So I'm a bit lost there.

Any guidance? Many thanks.
(new to VB4 today)

DesignWerks 03-11-2010 10:50 AM

Quote:

Originally Posted by M4tEUSh (Post 1993295)
So how to properly construct a condition with {vb:raw var}?

Bumping this question. I have my conditional working but it would be more efficient if I could use it with a plugin for an external php page which updates several areas of my site at once so <vb:if condition="!is_member_of($bbuserinfo, 12)">{vb:raw includemyexternalpage}</vb:if> hides the section from usergroup 12.

Is it possible to put the condition in the plugin?

boatdesign 03-12-2010 03:59 AM

Quote:

Originally Posted by boatdesign (Post 2001366)
I'm trying to use a conditional to color code certain forums in the What's New and Search Results.

In search_threadbit I've tried the following, with no success (only the else shows for threads in these forums too.)
Code:

<vb:if condition="in_array($foruminfo[forumid],array(26,29,56,25,27))">
<div class="threadpostedin td alt">
<p>Test Different Color Div will go here For these Forums</p>
</div>
<vb:else />
<div class="threadpostedin td alt">
<p>
{vb:rawphrase forum}: <a href="{vb:link forum, {vb:raw thread}, null, 'forumid', 'forumtitle'}" title="{vb:raw thread.forumtitleclean}">{vb:raw thread.forumtitle}</a>
</p>               
</div>
</vb:if>

I thought that since forumid is actually in the link, it would be a piece of cake, but it's a no go as above. I must be missing something obvious.

I read here about assigning a variable to a template, so tried creating a new plugin to do so, but can't seem to make that work either. One question is that the template is labeled search_threadbit but that's not a choice in the add plugin screen for a hook location - only search_results_threabit which doesn't seem to exist as a template. So I'm a bit lost there.

Any guidance? Many thanks.
(new to VB4 today)

Sorry - I got lost and couldn't see the forest for the trees. Thanks to Lynne for pointing out that for the search_threadbit template $thread[forumid] not $foruminfo[forumid] was the ticket.

kingMOB 03-13-2010 09:22 PM

Is there an "at least this" conditional?

I have this conditional to list just the blogs from a specific category:

PHP Code:

<vb:if condition="$blog['categories'] == 6"

It works well, but only if the blog entry is marked with only this category (6). If I choose one more category to the blog, let's say 5 and 6, this conditional no longer works.

Any help? =)

nack 03-15-2010 10:12 PM

Hi, how would you direct guests to login with <if condition>?

MrToasty 03-16-2010 10:10 AM

I have a custom template being called at the template hook in the postbit called postbit_userinfo_right_after_posts which works fine with static text from the template outside of conditionals, however when I try to use text in a conditional or pull a field such as {vb:var post.fieldX}, nothing happens...

I am able to call conditionals in the postbit template without any problems, just not in the custom template.

The conditional and field I'm trying to use is:-

Code:

<vb:if condition="$post['fieldX']"><dt>Field Title</dt> <dd>{vb:var post.fieldX}</dd></vb:if>
Any ideas?

cmiller1014 03-19-2010 03:03 AM

What about a conditional to have an ad appear after every 2 posts? used to be easy in vb 3.8, not now! :( :(

meonet 03-19-2010 06:44 AM

Hello,

I would like to show different size ads for memvers and guests, someone can help me to see if this code it's correct?

Quote:

<vb:if condition="in_array($bbuserinfo['usergroupid'], array(usergroupshere))">
advert here
</vb:if>
Thanks


All times are GMT. The time now is 12:06 AM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03583 seconds
  • Memory Usage 1,746KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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