首页 > 其他 > 详细

[MODX] 3. Placeholder +

时间:2014-12-19 23:18:47      阅读:327      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!