Template Tags

Given the following settings, Custom System Messages will deliver all ExpressionEngine's action and form messages inline with your normal templates. In this case the messages.group/error.html file will serve as the default template for all global error messages. The template code below is an example of a basic sign in form in the /account.group/sign-in.html file. It is also defined in the Custom Actions section as the template to use for success and error messages when submitting the sign in form. All other non-login related errors in this example will be displayed in the /messages.group/error.html template. Note that both Submission Error and General Error fields are required.

If you add a {redirect=""} tag in any of your templates defined in CSM, then the error messags will not be displayed in the template, even if the template you're redirecting to is defined in CSM to handle errors. This is because the messages are not saved during a full http request/redirect. All redirections need to be handled by CSM as defined in it's settings.

account/sign-in Template

{if csm:error == true && csm:action == 11}
    <div class="form-error-section">
        <div class="error-message">
            <strong>The following errors were encountered:</strong>
            <ul class="error-fields">

    <h3>SIGN IN</h3>
    <p>Don’t have an account yet? <a href="{path='account/register'}">Create an account.</a></p>
    <p><a href="{path='account/forgot-password'}">Forgot your password?</a></p>

    {exp:member:login_form return="account/sign-in"}
            <label for="signin-email">Email Addresss <span class="input-desc">(Username)</span><span class="input-required">*</span></label>
            <input type="text" id="signin-email" name="username" />
            <label for="signin-password">Password <span class="input-required">*</span></label>
            <input type="password" id="signin-password" name="password" />
            <button type="submit" name="submit" value="SIGN IN">SIGN IN</button>


The result of this configuration is the error messages are shown above the login form, instead of on a separate template, and at the same URL. You can still use a separate template if you like. The combination of settings in Custom System Messages gives you the flexibility to use whichever template you prefer to display your sites error or success messages.

Last updated