![]() |
Help on using conditionals based on the length of first post in a thread
Hi
I am talking about only the very first post in any thread. Suppose, I have a thread with more 1,000 characters in 'showthread' template. I want to place a conditional statement in the postbit template so that if the length of first post is less than say '500' characters then a statement is executed otherwise another. For Example Code:
Thanks in advance Best Regards |
With 'statement' you mean display a text, or execute coding? Coding can not be executed in a template.
Anyway, what you are trying to do can be done in a Plugin, not in a template, unless you want to write cstom JavaScript coding. |
Yes, i want to show different text messages on meeting the criteria. Is there any similar plugin available? Could not find one like this one. Thanks
|
Try putting the below into postbit_display_start
PHP Code:
HTML Code:
<if condition="$post['postcount'] == 1"> |
Its not working as desired. It is not calculating the character length of the message for showing the conditional text message.
In the postbit template i am using the following statement <if condition="$post['text_length'] <= 500"> OUTPUT ONE <else /> OUTPUT TWO </if> I have tried changing <= 500 characters to 1 and 5 or even 500000 but it produces only one output ie. OUTPUT ONE, which is not the desired result. Further guidance required, please. Adding following code in the plugin produces 000 on the screen. --> echo strlen($text_length); |
Try changing the plugin to
PHP Code:
|
The result echoed was 0
|
Ill take a look later this afternoon, 'message' is obviously wrong.
|
Maybe just add a global $post
|
Please do it, i am counting upon you. :)
|
All times are GMT. The time now is 03:57 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|