3.2 & 3.3 3.2.x SnippetsLong lost statements

Previous topicNext topic
User avatar

Topic Author
    Linux Chrome
Magic user status: Offline
Posts: 4690
Joined: Apr 6th, '14, 14:12

Long lost statements

Post by martin »

If Statements that was posted by RMcGirr83 originally. Plus some addons by Stoker but changed to 3.2+ by me

Code: Select all

{% IF S_USER_LOGGED_IN %} If a user is logged in
{% 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
{% 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,memberlst,faq etc)
{% if S_USERNAME eq "dmzx" %}Some content here{% endif %}
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 %}
Which will only show to registered users.

Code: Select all

 {% if FORUM_ID eq 2 %}Welcome to Forum Number 2{% endif %}
Which will only show if the viewer is within Forum Id #2.

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 %}
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.

These work with cssmagic 3.0.9 no core edit needed to make them work or marti group template ext not needed either. :wink:
Use this to install an ext on your board no more ftp or path making.
Path too install this ext is ext/boardtools/upload
Download is here Make it easy for us to solve your issues
Previous topicNext topic