vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Why i can?t get it work? (https://vborg.vbsupport.ru/showthread.php?t=193313)

maar3amt 10-10-2008 10:04 PM

Why i can?t get it work?
 
Hi ppl
Why i can't get this code work on postbit_legancy?

Code:

<if condition="$post[posts] >= 200">
Some text
</if>


orryun 10-10-2008 10:48 PM

Your code works fine with me.
Where exactly doesn't this code work?
Try insert DIV tags, like so: <div>Some text</div>

Lynne 10-10-2008 10:56 PM

Maybe try $post['posts']

orryun 10-10-2008 11:20 PM

Quote:

Originally Posted by Lynne (Post 1642325)
Maybe try $post['posts']

I have tried the $post[posts] thingy and it worked nicely on vB 3.8.0 b1

I think it's about the location of the code.

Lynne 10-10-2008 11:34 PM

Quote:

Originally Posted by orryun (Post 1642334)
I have tried the $post[posts] thingy and it worked nicely on vB 3.8.0 b1

I think it's about the location of the code.

Yeah, could be. I can never remember when to use quotes and when not to. One of these days I'll learn!

maar3amt 10-11-2008 01:00 AM

well on left side after user avatar i want show a message if user have more than 200 posts like.
<if condition="$post[posts] >= 200">
I have more than 200 posts
</if>
<else>
I have less thab 200 posts

Lynne 10-11-2008 03:46 AM

Well, your condition is written incorrectly:

HTML Code:

<if condition="$post[posts] >= 200">
I have more than 200 posts
<else />
I have less thab 200 posts
</if>


Dismounted 10-11-2008 04:19 AM

$post[posts] is equal to $post['posts'] and is also equal to $post["posts"] if no constant with the name "posts" exists. PHP will actually output a warning if you do not quote the array key. PHP actually first searches for a constant called "posts", then it looks up the array for an element with key "posts".

maar3amt 10-12-2008 03:27 PM

Yes this code work if user ha less than 1,000 posts if have higher don't work propely.

Lynne 10-12-2008 04:32 PM

Quote:

Originally Posted by maar3amt (Post 1643383)
Yes this code work if user ha less than 1,000 posts if have higher don't work propely.

Yes, that is correct. The variable is actually a formatted variable and so if you wish to do comparisons to it with numbers greater than 1,000, you need to deal with it using php code and thus in a plugin.



edit to add: You can always do the reverse comparison and it should work:
HTML Code:

<if condition="$post[posts] <= 200">
I have less than 200 posts
<else />
I have more than 200 posts
</if>



All times are GMT. The time now is 02:29 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.01201 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
  • (1)bbcode_code_printable
  • (2)bbcode_html_printable
  • (3)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