码迷,mamicode.com
首页 > 其他好文 > 详细

[MODX] 3. Placeholder +

时间:2014-12-19 23:19:29      阅读:295      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

 

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.

 

[MODX] 3. Placeholder +

标签:

原文地址:http://www.cnblogs.com/Answer1215/p/4174818.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!