peregm
Member
Hi there!
I really didn't know how to phrase this, so maybe the title does not have any sense at all, but here is what I'm meaning:
Is it possible to have a macro that includes the content specified between the macro tags? Here's an example:
Assume I have this macro defined in my test_macros template:
And in some other template, I want to replace the
So, the actual content that will be rendered in my page would be:
I know I can actually pass variables to my macro using the arg-varName tag, but what I do really want is to pass an entire block of code/template/macro to one of these variables.
Can I achieve something similar to this using some template syntax?
Thanks!
I really didn't know how to phrase this, so maybe the title does not have any sense at all, but here is what I'm meaning:
Is it possible to have a macro that includes the content specified between the macro tags? Here's an example:
Assume I have this macro defined in my test_macros template:
XML:
<xf:macro name="macro1">
<h1 class="title">Some title</h1>
<div class="content">
{{$content}}
</div>
</xf:macro>
And in some other template, I want to replace the
$content
variable with all the code that is inserted inside the macro call:
XML:
<xf:macro template="test_macros" name="macro1">
<span>Some content</span>
<p>Some other content...</p>
</xf:macro>
<xf:macro template="test_macros" name="macro1">
<span>Some other content</span>
<ul>
<li>Foo</li>
<li>Bar</li>
<li>Baz</li>
</ul>
</xf:macro>
So, the actual content that will be rendered in my page would be:
HTML:
<h1 class="title">Some title</h1>
<div class="content">
<span>Some content</span>
<p>Some other content...</p>
</div>
<h1 class="title">Some title</h1>
<div class="content">
<span>Some other content</span>
<ul>
<li>Foo</li>
<li>Bar</li>
<li>Baz</li>
</ul>
</div>
I know I can actually pass variables to my macro using the arg-varName tag, but what I do really want is to pass an entire block of code/template/macro to one of these variables.
Can I achieve something similar to this using some template syntax?
Thanks!