阅读:1634次
评论:0条
更新时间:2011-05-26
在base.mako中添加:
<% self.seen_css = set() %>
<head>
${self.css()}
</head>
<%def name="css_link(path, media='')">
% if path not in self.seen_css:
<link rel="stylesheet" type="text/css" href="${path|h}" media="${media}"></link>
% endif
<% self.seen_scripts.add(path) %>
</%def>
<%def name="css()">
${css_link('/css/main.css', 'screen')}
${css_link('/css/navigation.css', 'screen')}
${css_link('/css/forms-buttons.css', 'screen')}
${css_link('/css/orders.css', 'screen')}
</%def>
如果你想在子模板中加入新的css,那么
<%def name="css()">
${parent.css()}
${self.css_link('/css/products.css', 'screen')}
</%def>
引用
<% self.seen_css = set() %>
<head>
${self.css()}
</head>
<%def name="css_link(path, media='')">
% if path not in self.seen_css:
<link rel="stylesheet" type="text/css" href="${path|h}" media="${media}"></link>
% endif
<% self.seen_scripts.add(path) %>
</%def>
<%def name="css()">
${css_link('/css/main.css', 'screen')}
${css_link('/css/navigation.css', 'screen')}
${css_link('/css/forms-buttons.css', 'screen')}
${css_link('/css/orders.css', 'screen')}
</%def>
如果你想在子模板中加入新的css,那么
引用
<%def name="css()">
${parent.css()}
${self.css_link('/css/products.css', 'screen')}
</%def>
评论 共 0 条 请登录后发表评论