zpt
Version:
Zenon Page Templates - JS (ZPT-JS)
91 lines (82 loc) • 4.13 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>ZPT-JS reference - Attributes - METALDefineSlot</title>
<script type="module" src="../js/zpt.js"></script>
<script type="text/javascript" src="../lib/syntaxHighlighter/lib.js"></script>
<link rel="stylesheet" type="text/css" href="../docs.css">
<link rel="stylesheet" type="text/css" href="../lib/syntaxHighlighter/theme.css">
</head>
<body>
<div data-use-macro="'page@templates.html'">
<div data-fill-slot="'page-header'">
<h1>ZPT-JS reference - Attributes - METALDefineSlot</h1>
<ul>
<li><a href="#syntax">Syntax</a>.</li>
<li><a href="#description">Description</a>.</li>
<li><a href="#differences">Differences with ZPT</a>.</li>
<li><a href="#examples">Examples</a>.</li>
</ul>
</div>
<article data-fill-slot="'article'">
<h2 data-attributes="id 'syntax'">Syntax</h2>
<pre class="syntax">
argument ::= Name
</pre>
<h2 data-attributes="id 'description'">Description</h2>
<p>
The <em>data-define-slot</em> statement defines a macro customization point or slot. When a macro is used, its slots can be replaced, in order to customize the macro. Slot definitions provide default content for the slot. You will get the default slot contents if you decide not to customize the macro when using it.
</p>
<p>
The <em>data-define-slot</em> statement must be used inside a <a href="attributes-METALDefineMacro.html">data-define-macro</a> statement.
</p>
<p>
Slot names must be unique within a macro.
</p>
<p>
Note: some parts extracted from <a href="https://zope.readthedocs.io/en/latest/zopebook/AppendixC.html#define-slot-define-a-macro-customization-point">Zope Page Templates Reference</a>.
</p>
<h2 data-attributes="id 'differences'">Differences with ZPT</h2>
<p>
None.
</p>
<h2 data-attributes="id 'examples'">Examples</h2>
<p>
Macro with 1 slot (<em>additional_info</em>):
</p>
<pre class="brush: html">
<div data-define-macro="enhacedSidebar">
Links
<div>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/products">Products</a></li>
<li><a href="/support">Support</a></li>
<li><a href="/contact">Contact Us</a></li>
</ul>
</div>
<span data-define-slot="additional_info"></span>
</div>
</pre>
<p>
Macro with 2 slots (<em>links</em> and <em>additional_info</em>):
</p>
<pre class="brush: html">
<div data-define-macro="enhacedSidebar">
Links
<div data-define-slot="links">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/products">Products</a></li>
<li><a href="/support">Support</a></li>
<li><a href="/contact">Contact Us</a></li>
</ul>
</div>
<span data-define-slot="additional_info"></span>
</div>
</pre>
</article>
</div>
</body>
</html>