• [MODx] 6. Cache '!' with login package


    1. Install login package.

    2. Create a Template called 'login':

    [[!Login? 
        &loginResourceId=`13`  // means after login, redirect resource 13 page, in our case, redirect to self
    ]]
    <h2>Register</h2>
     
    [[!Register?
        &submitVar=`registerbtn`
        &activationResourceId=`12`
        &activationEmailTpl=`myActivationEmailTpl`
        &activationEmailSubject=`Thanks for Registering!`
        &submittedResourceId=`5`
        &usergroups=`Marketing,Research`
        &validate=`nospam:blank,
      username:required:minLength=^6^,
      password:required:minLength=^6^,
      password_confirm:password_confirm=^password^,
      fullname:required,
      email:required:email`
        &placeholderPrefix=`reg.`
    ]]
     
    <div class="register">
        <div class="registerMessage">[[!+reg.error.message]]</div>
     
        <form class="form" action="[[~[[*id]]]]" method="post">
            <input type="hidden" name="nospam" value="[[!+reg.nospam]]" />
     
            <label for="username">[[%register.username? &namespace=`login` &topic=`register`]]
                <span class="error">[[!+reg.error.username]]</span>
            </label>
            <input type="text" name="username" id="username" value="[[!+reg.username]]" />
     
            <label for="password">[[%register.password]]
                <span class="error">[[!+reg.error.password]]</span>
            </label>
            <input type="password" name="password" id="password" value="[[!+reg.password]]" />
     
            <label for="password_confirm">[[%register.password_confirm]]
                <span class="error">[[!+reg.error.password_confirm]]</span>
            </label>
            <input type="password" name="password_confirm" id="password_confirm" value="[[!+reg.password_confirm]]" />
     
            <label for="fullname">[[%register.fullname]]
                <span class="error">[[!+reg.error.fullname]]</span>
            </label>
            <input type="text" name="fullname" id="fullname" value="[[!+reg.fullname]]" />
     
            <label for="email">[[%register.email]]
                <span class="error">[[!+reg.error.email]]</span>
            </label>
            <input type="text" name="email" id="email" value="[[!+reg.email]]" />
     
            <br class="clear" />
     
            <div class="form-buttons">
                <input type="submit" name="registerbtn" value="Register" />
            </div>
        </form>
    </div>
    
    [[!Profile]]
     
    <p>Username: [[+username]]</p>
    <p>Email: [[+email]]</p>

    In the bottom, we call the [[!Profile]] snippet without cache. So every time, we logout, the profile will be clear up.  

    If we call [[Profile]], then everytime, we logout, the username and email are still there.

    Caching

    In Evolution, Snippets that need to be processed with each request should be on an uncached page or the Snippet itself should be called uncached: [!snippet!]

    In Revolution, any tag can be called uncached by inserting an exclamation point immediately after the double-bracket: [[!snippet]], [[!$chunk]], [[!+placeholder]], [[!*template_var]], etc.

  • 相关阅读:
    【BZOJ4367】[IOI2014]holiday假期 分治+主席树
    【BZOJ1264】[AHOI2006]基因匹配Match DP+树状数组
    【BZOJ4379】[POI2015]Modernizacja autostrady 树形DP
    【BZOJ4380】[POI2015]Myjnie 区间DP
    【BZOJ4382】[POI2015]Podział naszyjnika 堆+并查集+树状数组
    【BZOJ4384】[POI2015]Trzy wieże 树状数组
    【BZOJ4388】JOI2012 invitation 堆+线段树+并查集(模拟Prim)
    【BZOJ4550】小奇的博弈 博弈论
    Sqlserver列出所有数据库名,表名,字段名
    聚合与组合的区别?
  • 原文地址:https://www.cnblogs.com/Answer1215/p/4209408.html
Copyright © 2020-2023  润新知