• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

simple "if" condition

karev

Active member
#1
hello community,im a really novice to oop php developpement but i try to verify if the post ID==1
i mean to verify if its the first post in a thread can someone help me please ??
 

James

Well-known member
#2
In templates, arrays use the dot (.) operator.

Have you checked if $message has the array key post_id? I'll check in a second and get back to you.
 

SneakyDave

Well-known member
#3
I think this works, to determine the first post position, assuming you want it in a xF template.
Code:
<xen:if is="{$post.position} == 0>
.. do something crazy ..
</xen:if>
 

karev

Active member
#4
In templates, arrays use the dot (.) operator.

Have you checked if $message has the array key post_id? I'll check in a second and get back to you.
i just give example i dont know if its correct okey i'll delete the example to not confuse people XD
 

James

Well-known member
#8
A simple workaround (from a quick 5sec glance) would be to add another condition to the if ($visitor['user_id'] <= 0)

Something like: if (($visitor['user_id'] <= 0) && ($message['post_id'] == '1'))
 

EQnoble

Well-known member
#14
Basically you want unregistered users to not be able to view the contents of the original post unless they are logged in with permissions right?
 

Ajaxboy

Active member
#16
Well first you gotta get the thread object then, you gotta go from there..

If you are novice, I would not recommend editing things as it could brake something. But otherwise, post what you have and will try to point you on the right path..