A few updates.
Here are the if statements that was posted by RMcGirr83 originally. Plus some addons by Stoker.
Original topic
Code: Select all
{% if S_USER_LOGGED_IN %}your content here (for users logged in){% else %}your content here (for viewing as a guest){% endif %}
{% if S_REGISTERED_USER %} If user is logged in and not a bot{% endif %}
{% if S_USER_NEW %} If user is in the newly registered group{% endif %}
{% if S_AUTOLOGIN_ENABLED %} If auto login is allowed{% endif %}
{% if S_BOARD_DISABLED %} If board is disabled{% endif %}
{% if S_IS_BOT %} If a bot{% endif %}
{% if S_USER_PM_POPUP %} If pop up pm is on{% endif %}
{% if S_DISPLAY_SEARCH %} If displays search{% endif %}
{% if S_DISPLAY_PM %} If display a PM{% endif %}
{% if S_DISPLAY_MEMBERLIST %} If display memberlist.php{% endif %}
{% if U_MCP %} If Moderator{% endif %}
{% if U_ACP %} If Administrator{% endif %}
{% if S_IS_LINK %} If its a link{% endif %}
{% if S_UNREAD_FORUM %} If forum is unread{% endif %}
{% if S_READ_FORUM %} If forum is read{% endif %}
{% if S_LOCKED_FORUM %} If forum is locked{% endif %}
{% if S_LIST_SUBFORUMS %} If there is a list of subforums{% endif %}
{% if S_SUBFORUMS %} If a subforum{% endif %}
{% if S_IS_CAT %} If a category{% endif %}
{% if S_IS_POST %} If a post{% endif %}
{% if FORUM_ID eq 2 %} Displays the code between the switches if the user is viewing a forum with ID 2.{% endif %}
{% if FORUM_ID in [2,4,11,25] %} Several forum ID's{% endif %}
{% if TOPIC_ID eq 2 %} Displays the code between the switches if the user is viewing a topic with ID 2.{% endif %}
{% if SCRIPT_NAME == "index" %}some content{% endif %} (Others you can use, viewtopic,viewforum,memberlst,faq etc){% endif %}
{% if S_USERNAME eq "Stoker" %}Some content here{% endif %}
{% if S_USERNAME in ['name1', 'name2', 'name3, 'name4, 'name5, 'name6'] %}Several usernames{% endif %}
{% if S_IN_UCP %} In User Controlpanel, login, register{% endif %}
{% if S_IN_MEMBERLIST %} In Profiles, Memberlist, TeamPage etc{% endif %}
Let's say you wanted something to show in an html file for registered users only, then you could use the following
Examples:
This will only show to registered users:
Code: Select all
{% if S_REGISTERED_USER %}Hello, welcome to blahblah.com{% endif %}
This will only show if the viewer is within Forum Id #2:
Code: Select all
{% if FORUM_ID eq 2 %}Welcome to Forum Number 2{% endif %}
And for several forums:
Code: Select all
{% if FORUM_ID in [2,4,11,25] %}Code here{% 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 %}
Sevaral users:
Code: Select all
{% if S_USERNAME in ['name1', 'name2', 'name3', 'name4', 'name5', 'name6'] %}Several usernames{% 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.Also check this one out for groups: https://www.phpbb.com/customise/db/exte ... variables/