Reuse Template Code rename

author:

contributor:

published:

updated:

source uri:

Summary

Often, you need to render a certain kind of things in the same way on different web pages served by...

Content

Often, you need to render a certain kind of things in the same way on different web pages served by different Acre template files. You can extract out that rendering code into an Acre sub-template. Create another file to store one or more such sub-templates, e.g.,

>
>
> $p1 $p2 ...
>
>
>
>
> ...
>

Then call these sub-templates from the original template files, e.g.,

>
>
> var templates = acre.require("id_of_file_containing_sub_templates");
>
> ...
>
> ...
> ${templates.render1(arg1, arg2)}

You could also define a sub-template within a full template file.

Created by: dfhuynh via Cookbook Jun 4, 2009
Last edited by: dfhuynh via Cookbook Jul 9, 2009

Recent Discussions about Reuse Template Code

There is no discussion about this document.

Start the Discussion »
Explore the Data
View all the data we have for Reuse Template Code
Flag this Document
Why do you want to flag this document?