vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   If condition (https://vborg.vbsupport.ru/showthread.php?t=234129)

ARP 01-25-2010 02:00 PM

If condition
 
Hello all,

I'm trying to use some text in the first post so in vb3 was

<if condition="(($post[postcount] == 1))">

And now what's the new code with vb4 ?

Thanks.

Lynne 01-25-2010 02:20 PM

Have you tried that condition? (except replace <if with <vb:if and </if> with </vb:if> )

wolfe 01-25-2010 02:35 PM

try this m8

PHP Code:


<vb:if condition="$post[postcount] = 1"text </vb:if>

and for <else /> 
its now  <vb:else /> 


ARP 01-25-2010 02:55 PM

Lynne, Tried it now but it doesn't work.

wolfe, the code appear in all posts

Lynne 01-25-2010 03:13 PM

You need to use == , not =

When saying something doesn't work, you need to post exactly what you are trying AND tell us exactly where in what template you are putting it.

ARP 01-25-2010 03:28 PM

Quote:

Originally Posted by Lynne (Post 1966228)
You need to use == , not =

When saying something doesn't work, you need to post exactly what you are trying AND tell us exactly where in what template you are putting it.

Yes, I know to use ==

That's the code :
HTML Code:

<vb:if condition="$post[postcount] == 1">
{vb:raw thread.title}
</vb:if>

And using template hook postbit end and the plugin postbit_display_complete

Lynne 01-25-2010 03:54 PM

I don't see anything in there about a template_hook. And, how is this related to using the postbit_display_complete hook location? I thought you were just editing one of the postbit templates. That code will not work in a plugin - it isn't proper php.

Digital Jedi 01-25-2010 04:19 PM

Quote:

Originally Posted by ARP (Post 1966238)
Yes, I know to use ==

That's the code :
HTML Code:

<vb:if condition="$post[postcount] == 1">
{vb:raw thread.title}
</vb:if>

And using template hook postbit end and the plugin postbit_display_complete

That's why you need to be specific as to what your doing. Template conditionals never worked in plugins on any version of vB.

ARP 01-26-2010 09:44 AM

Yes Guys, I know all of that. What I had posted above that's my template and the plugin is that.
PHP Code:

$templater vB_Template::create('ARP_TEMPLATE');

$template_hook["postbit_end"] .= $templater->render(); 


Lynne 01-26-2010 02:06 PM

So it's a custom template and you are using both the $post and $thread variables in it.... Did you register them for use in that template? If not, then you won't be able to use them in there. Read this article on registering variables - [vB4] Rendering templates and registering variables - a short guide


All times are GMT. The time now is 08:49 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.01082 seconds
  • Memory Usage 1,738KB
  • 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
  • (2)bbcode_html_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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