use_macro Template Tag
Synopsis
The use_macro tag includes another template into the current template with the option to override certain sections.
Parameters
| Name | Description | Version |
|---|---|---|
| file | The path the template to include (within the templates directory). | 0.6 |
Example
In this example we will create a template for a user profile, but this template will include a slot that can be overridden by other templates to customize the user bio.
user-profile.html
<html>
<head>
<title>User profile</title>
</head>
<body>
<h1>User bio</h1>
<div id="bio">
{define_slot name="bio"}
This text will be overridden by other templates to place the correct
bio information.
{/define_slot}
</body>
</html>
steve-profile.html
{use_macro file="user-profile.html"}
{fill_slot name="bio"}
This is Steve's bio. It will override the text in the bio slot.
{/fill_slot}
{/use_macro}
See also:
- Xataface templates
- The define_slot tag
- The fill_slot tag
- Changing the Look & Feel of Xataface (From the Getting Started Tutorial)
- Cusomizing the Xataface Look & Feel Tutorial
var disqus_identifier = ‘xataface.com/wiki/templates:tags:use_macro’; (function() { var dsq = document.createElement(‘script’); dsq.type = ‘text/javascript’; dsq.async = true; dsq.src = ‘http://xataface.disqus.com/embed.js’; (document.getElementsByTagName(‘head’)[0] || document.getElementsByTagName(‘body’)[0]).appendChild(dsq); })(); blog comments powered by Disqus
//<![CDATA[ (function() { var links = document.getElementsByTagName(‘a’); var query = ‘?’; for(var i = 0; i < links.length; i++) { if(links[i].href.indexOf(‘#disqus_thread’) >= 0) { query += ‘url’ + i + ‘=’ + encodeURIComponent(links[i].href) + ‘&’; } } document.write(‘