![]() |
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. |
Have you tried that condition? (except replace <if with <vb:if and </if> with </vb:if> )
|
try this m8
PHP Code:
|
Lynne, Tried it now but it doesn't work.
wolfe, the code appear in all posts |
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. |
Quote:
That's the code : HTML Code:
<vb:if condition="$post[postcount] == 1"> |
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.
|
Quote:
|
Yes Guys, I know all of that. What I had posted above that's my template and the plugin is that.
PHP Code:
|
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
|
OK Lynne, It's registered now, However the first post condition doesn't work and If I remove the If tag it's working and rendering the template.
HTML Code:
<vb:if condition="$post[postcount] == 1"> PHP Code:
|
To see if it's the first post, use this condition:
HTML Code:
<vb:if condition="$post['postid'] == $thread['firstpostid']"> |
Could it be that you are using 1, the boolean value for true?
Have you tried: Code:
<vb:if condition="$post[postcount] == '1'">{vb:raw arp_var}</vb:if> |
shouldnt you also register post variable in your template?
Code:
$arp_var = "{vb:raw thread.title}"; F. |
Quote:
Also all other suggests doesn't work. |
There is no bug, you must register any variables used in the template, including those in the conditionals (certain ones like $show are auto available).
In you case, you must register both $post and $thread (in blue). Code:
$arp_var = "{vb:raw thread.title}"; Also, I dont know what the line is red is for, but all you will output is the text {vb:raw thread.title} |
You haven't registered the $thread variable for use in your template, so it's not going to work.
Any variable array you want to use in a template must be registered. |
Quote:
Thanks All is working now. --------------- Added [DATE]1264763223[/DATE] at [TIME]1264763223[/TIME] --------------- Quote:
|
All times are GMT. The time now is 04:36 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|