Skip to content

Instantly share code, notes, and snippets.

@wichert
Created July 14, 2011 09:15
Show Gist options
  • Save wichert/1082147 to your computer and use it in GitHub Desktop.
Save wichert/1082147 to your computer and use it in GitHub Desktop.
Chameleon XI/Metal combination trick
<!-- tools.pt -->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
xmlns:meta="http://xml.zope.org/namespaces/meta"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:tal="http://xml.zope.org/namespaces/tal"
meta:interpolation="true"
tal:condition="False">
<metal:tooltip define-macro="tooltip">
<div class="tooltip">
<h5>${article.title}</h5>
<p>${article.description}</p>
</div>
</metal:tooltip>
</html>
<!-- Page template -->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
xmlns:meta="http://xml.zope.org/namespaces/meta"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:xi="http://www.w3.org/2001/XInclude"
meta:interpolation="true"
tal:condition="False">
<xi:include href="mypackage.ui:templates/common.pt"/>
<body>
<ul class="articles">
<li tal:repeat="article recent_articles()">
<metal:tooltip use-macro="tooltip"/>
</li>
</ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment