zoukankan      html  css  js  c++  java
  • [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.

  • 相关阅读:
    VI中的批量替换--转载
    Zookeeper集群
    Zookeeper实现Master选举(哨兵机制)
    分布式session之token解决方案实现
    浏览器
    分布式session之redis解决方案实现
    服务器操作常用
    Nginx安装教程(Centos6.8)
    分布式锁(Redis实现)
    开发总结
  • 原文地址:https://www.cnblogs.com/Answer1215/p/4209408.html
Copyright © 2011-2022 走看看