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.

  • 相关阅读:
    WPF/Sliverlight ScrollViewer与Panel(2)
    OpenGL学习笔记(7)多边形绘制
    OpenGL学习笔记(10)抗锯齿
    OpenGL学习笔记(9)颜色混合
    GLUT函数说明(转)
    OpenGL学习笔记(8)显示列表
    C#操作IIS的代码
    完整解决Flash载入中文FLASH乱码问题
    用C#的IIS上配置用户账号
    ASP.NET定时调用WebService 运行后台代码
  • 原文地址:https://www.cnblogs.com/Answer1215/p/4209408.html
Copyright © 2011-2022 走看看