Plone技术资料

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 3949|回复: 0

使用Diazo变量

[复制链接]
发表于 2014-12-21 13:59:18 | 显示全部楼层 |阅读模式
Variables can be used in your Diazo rules.xml from TAL expressions set in your theme. These variables are defined in your theme's manifest.cfg like so:
  1. [theme:parameters]
  2. portal_url = portal_state/portal_url
  3. ajax_load = python: 'ajax_load' in request.form
  4. anon_user = portal_state/anonymous
复制代码

These are some commonly used variables. Just like TAL, they use path expressions by default, but python: or string: can be specified.
If the parameters were set directly in the manifest.cfg, you will need to reactivate the theme in the Theming control panel (deactivate, then activate). The parameters can also be set in the control panel's Advanced Settings tab. Available variables that can be used within the expressions are context,                             request, portal,                             portal_state, and                             context_state.
Use in rules.xmlUse variables prefixed with $. If used in HTML within a rule, the variable also needs to be wrapped in curly braces:
  1. <drop css:content="#portal-breadcrumbs"
  2.       if-path="$portal_url"/>

  3. <replace css:theme="#sitesearch">
  4.   <form action="{$portal_url}/@@search" method="post">
  5.   ...
  6. </replace>
复制代码

Simple condition expressions can also be done in the rules using the variables:
  1. <drop css:theme=".manageLink"
  2.       if="$role != 'administrator'"/>
复制代码


I hope this gives you a brief understanding of how to apply variables in your Diazo theme. You can learn more at Diazo.org and also find more trainings like this one at sixfeetup.com/plone-cms/plone-how-to.

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|Plone技术资料 ( 湘ICP备14006519号-1 )

GMT+8, 2019-11-19 08:42 , Processed in 0.046008 second(s), 18 queries , Gzip On.

Powered by Plone! X3.4

© 2001-2019 Plone.org.

快速回复 返回顶部 返回列表