zoukankan      html  css  js  c++  java
  • [MODX] 3. Placeholder +

    A chunk may be used in many pages, different page may require different style.

    We can use Placeholder to pass in the value.

    [[+placeholder_name]]

    For exmaple, now we want our home page has blue title and about page has green title.

    First, we copy the interior template and create two new template call 'Home template' and 'About Template'.

    in html_header chunk: we set up the placeholder

          <header class="group">
            <div class="logo">
              <h1 style="color: [[+html_header_color]]">
                [[*longtitle]]
              </h1>
            </div>

    In Home template: a '?' followed by '&' to pass in k-v pair

    [[$html_header?&html_header_color=`lightblue`]]

    In About template, we do nothing just like:

    [[$html_header]]

    What we want is use defulat value for the placeholder.

    Defulat value:


    First: click 'Unlock default properites', then create new property. We set color as lightgreen.

    Save it.

    Then the page should display as we want.

  • 相关阅读:
    MVC三层架构
    Cookie
    request (请求转发)
    response 重定向
    HttpServletResponse(响应),实现文件下载,实现验证码功能
    HTTP报文格式
    基于UUID生成短ID
    一致性hash应用到redis
    spring-mysqlclient开源了
    Effection Go
  • 原文地址:https://www.cnblogs.com/Answer1215/p/4174818.html
Copyright © 2011-2022 走看看