6. Conditional Tags

6.1. iflang

This tag can be used to show some html in a particular language only.

Attributes:

  • id: the code of the desired language (e.g. en for English).

6.2. ifuser, ifnotuser

These tags mark a part of the page that must be shown only when a user has logged in or not.

These tags have no attributes.

Example 7.10. Displaying a message to a user

<mesh:ifuser>Welcome <mesh:user />!</mesh:ifuser>
<mesh:ifnotuser>You are not logged in</mesh:ifnotuser>

6.3. ifediting, ifnotediting

These tags are used to mark a part of the page that must be shown only when editing or viewing a page.

These tags have no attributes.

The ifnotediting tag is mainly used to enclose forms that would otherwise conflict with the main editing form.

Example 7.11. Inserting a search form without conflicting with the MeshCMS editor

<mesh:ifnotediting>
 <!-- Search Google -->
  <center>
   <FORM method=GET action="http://www.google.com/search">
    <input type=hidden name=ie value=UTF-8>
    <input type=hidden name=oe value=UTF-8>
    <TABLE bgcolor="#FFFFFF"><tr><td>
     <A HREF="http://www.google.com/">
     <IMG SRC="http://www.google.com/logos/Logo_40wht.gif" 
      border="0" ALT="Google" align="absmiddle"></A>
     <INPUT TYPE=text name=q size=25 maxlength=255 value="">
     <INPUT type=submit name=btnG VALUE="Google Search">
    </td></tr></TABLE>
   </FORM>
  </center>
 <!-- Search Google -->
</mesh:ifnotediting>

6.4. ifmodule, ifnotmodule

These tags are used to display a part of the page only when the specified module is active or not.

Attributes:

  • location (required): the name of the module location.

Example 7.12. Adding some HTML around a module

<mesh:ifmodule location="bottom">
 <div align="center">Module title</div>
 <mesh:module location="bottom" />
 <div align="center">End of module</div>
</mesh:ifmodule>

6.5. ifmailform, ifnotmailform

These tags are used to display a part of the page only if a recipient has been specified to receive messages from that page.

These tags have no attributes.

Example 7.13. Adding some HTML around a mail form

<mesh:ifmailform>
 <div align="center">Send a message</div>
 <mesh:mailform />
</mesh:ifmailform>

6.6. ifindexed, ifnotindexed

These tags detect whether the current page is in the site map or not.

These tags have no attributes.

6.7. ifadminpage, ifnotadminpage

These tags detect whether the current page is an admin page or not. They are useful when the theme is applied to admin pages.

These tags have no attributes.