IF Statements? (phpBB3 Only)

Comkid

Addicted
Joined
May 23, 2009
Messages
819
Reaction score
0
FP$
2,117
What are IF statements?
IF statements are used as HTML comments to make something happen if something has met the condition.

Why use IF statements?
Like in Twisty's guide at the start it uses an IF statement, which checks to see if the visitor is a guest and the register feature is not disabled.

How do you use IF statements?
To use IF statements, insert them like a HTML Comment, like this:
Code:
<!-- IF S_USER_LOGGED_IN -->Hello Mr. Logged In<!-- ELSEIF not S_USER_LOGGED_IN -->Please login kind sir<!--ENDIF -->

Structure of an IF statements?
First you will have the
Code:
<!--
followed by the IF and condition then
Code:
-->

IF statements loops?
To make a loop with IF statements you may use
Code:
<!-- ELSEIF condition -->
to end the an IF statement you must always use
Code:
<!-- ENDIF -->

Example Scenario: Hello, I am running phpBB3 and want to show my guests 'Please Register or Login', my normal users 'Welcome to my Site, Thank You for Signing Up', and staff 'Welcome Staff'.

Example Answer:
Code:
<!-- IF not S_USER_LOGGED_IN -->Please <!-- IF S_REGISTER_ENABLED -->Register or <!-- ENDIF -->Login<!-- ELSE IF S_USER_LOGGED_IN -->Welcome to my Site, Thank You for Signing Up<!-- ELSEIF U_ACP or U_MCP -->Welcome Staff<!-- ENDIF -->

Additional Variables for IF statements?
There are additional variables like
Code:
and
or
Code:
not
or
Code:
or
which can make your IF statement simpler.

Conditions List (From StarTrekGuide):
S_USER_LOGGED_IN
S_AUTOLOGIN_ENABLED
S_BOARD_DISABLED
S_IS_BOT
S_USER_PM_POPUP
S_DISPLAY_SEARCH
S_DISPLAY_PM
S_DISPLAY_MEMBERLIST
U_MCP
U_ACP
S_IS_LINK
S_UNREAD_FORUM
S_READ_FORUM
S_LOCKED_FORUM
S_LIST_SUBFORUMS
S_SUBFORUMS
S_IS_CAT
S_IS_POST

If you required any assistance, do NOT hesitate to add me on MSN or PM here. :yes:
 
Great job with that! thanks I know this will help a lot of people out! Did you know that soon they are making HTMl and PHP in english? Like: IF user is logged in show this = ect...

Pretty cool but not to get off track, +rep!
 
But what is above is english, anyway, no I didn't know. There are coding languages like that for instance, Java:

Code:
int Comkid = 1

if (Comkid == 1){
Do something
}

Thanks NewKirk 😀
 
Back
Top Bottom