IF Statements
Posted: 10 Mar 2010, 17:52
Here is the if statements that was posted by RMcGirr83 originally. Plus some addons by Stoker.
<!-- IF S_USER_LOGGED_IN --> If a user is logged in
<!-- IF S_REGISTERED_USER --> If user is logged in and not a bot
<!-- IF S_AUTOLOGIN_ENABLED --> If auto login is allowed
<!-- IF S_BOARD_DISABLED --> If board is disabled
<!-- IF S_IS_BOT --> If a bot
<!-- IF S_USER_PM_POPUP --> If pop up pm is on
<!-- IF S_DISPLAY_SEARCH --> If displays search
<!-- IF S_DISPLAY_PM --> If display a PM
<!-- IF S_DISPLAY_MEMBERLIST --> If display memberlist.php
<!-- IF U_MCP --> If Moderator
<!-- IF U_ACP --> If Administrator
<!-- IF S_IS_LINK --> If its a link
<!-- IF S_UNREAD_FORUM --> If forum is unread
<!-- IF S_READ_FORUM --> If forum is read
<!-- IF S_LOCKED_FORUM --> If forum is locked
<!-- IF S_LIST_SUBFORUMS --> If there is a list of subforums
<!-- IF S_SUBFORUMS --> If a subforum
<!-- IF S_IS_CAT --> If a category
<!-- IF S_IS_POST --> If a post
<!-- IF FORUM_ID --> Displays the code between the switches if the user is viewing a particular forum.
<!-- IF SCRIPT_NAME == "index" -->some content<!-- ENDIF --> (Others you can use, viewtopic,viewforum,memberlist,faq etc)
<!-- IF S_USERNAME eq 'Stoker' -->Some content here<!-- ENDIF -->
Examples
Let's say you wanted something to show in an html file for registered users only, then you could use the following
Which will only show to registered users.
or
Which will only show if the viewer is within Forum Id #2.
You can also combine the IF's
Also, you can use the following operands as well
or ( || )
and ( && )
eq ( == )
You can use either the language ones (or, and, eq) or the other ones ( ||, &&, ==).
Remember each time you have a <!-- IF something --> statement you must also have an ending <!-- ENDIF --> statement, else you will get errors when the templating engine does it's stuff.
this could be copied to tuturials.
<!-- IF S_USER_LOGGED_IN --> If a user is logged in
<!-- IF S_REGISTERED_USER --> If user is logged in and not a bot
<!-- IF S_AUTOLOGIN_ENABLED --> If auto login is allowed
<!-- IF S_BOARD_DISABLED --> If board is disabled
<!-- IF S_IS_BOT --> If a bot
<!-- IF S_USER_PM_POPUP --> If pop up pm is on
<!-- IF S_DISPLAY_SEARCH --> If displays search
<!-- IF S_DISPLAY_PM --> If display a PM
<!-- IF S_DISPLAY_MEMBERLIST --> If display memberlist.php
<!-- IF U_MCP --> If Moderator
<!-- IF U_ACP --> If Administrator
<!-- IF S_IS_LINK --> If its a link
<!-- IF S_UNREAD_FORUM --> If forum is unread
<!-- IF S_READ_FORUM --> If forum is read
<!-- IF S_LOCKED_FORUM --> If forum is locked
<!-- IF S_LIST_SUBFORUMS --> If there is a list of subforums
<!-- IF S_SUBFORUMS --> If a subforum
<!-- IF S_IS_CAT --> If a category
<!-- IF S_IS_POST --> If a post
<!-- IF FORUM_ID --> Displays the code between the switches if the user is viewing a particular forum.
<!-- IF SCRIPT_NAME == "index" -->some content<!-- ENDIF --> (Others you can use, viewtopic,viewforum,memberlist,faq etc)
<!-- IF S_USERNAME eq 'Stoker' -->Some content here<!-- ENDIF -->
Examples
Let's say you wanted something to show in an html file for registered users only, then you could use the following
Code: Select all
<!-- IF S_REGISTERED_USER -->Hello, welcome to blahblah.com<!-- ENDIF -->
or
Code: Select all
<!-- IF FORUM_ID eq 2 -->Welcome to Forum Number 2<!-- ENDIF -->
You can also combine the IF's
Code: Select all
<!-- IF FORUM_ID eq 2 and S_REGISTERED_USER -->Welcome to Forum ID #2 and you are a registered user<!-- ENDIF -->
or ( || )
and ( && )
eq ( == )
You can use either the language ones (or, and, eq) or the other ones ( ||, &&, ==).
Remember each time you have a <!-- IF something --> statement you must also have an ending <!-- ENDIF --> statement, else you will get errors when the templating engine does it's stuff.
this could be copied to tuturials.