Reuse Template Code rename
author:
contributor:
published:
updated:
source uri:
Freebase Apps Help Topic /freebase/apps/help_topic
Status:
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.
>
>
> $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.
Recent Discussions about Reuse Template Code
There is no discussion about this document.
Start the Discussion »