1. addsectiondictionary (section_name) returns a sub-dictionary associated with the given section_name (for instance, dict. addsectiondictionary ("mysect") for a template like {{# mysect }}... {/mysect }}).
After multiple calls, a new dictionary is returned each time. This section is displayed every time this function is called. If this function has never been called, the data in the section area is not displayed.
2. showsection () is used to display the text exactly once in the Section. it is equivalent to calling addsectiondictionary () once , and ignoring the returned sub-dictionary. all variables in the section will depend on dictionary inheritence to get their values. (inherited value)
3. setvalueandshowsection () used to show a section if and only if a related variable is set to a non-empty value. setvalueandshowsection (name, value, section_name) is equivalent to this: If value is empty do nothing, otherwise add a single dictionary to section_name and call section_dict-> addvalue (name, value ).
There are examples in the document, and no function has been found.
4. addmediadedictionary (section_name) returns a sub-dictionary associated with the given include_name (for instance, dict. addincludedictionary ("mytpl") for a template like {{> mytpl }}).
This function is similar to addsectiondictionary. It is called multiple times and a new dictionary is returned each time. After the call, remember to call setfilename.
5. Dump () and dumptostring () are used for debugging.
6. The templatecache class
Holds a collection of templates.
7. Usage of earlier versions:
Template * TPL = template: gettemplate (filename, strip_mode );
Templatedictionary dict (name );
TPL-> Expand (& dict, & outstring );
New Version:
STD: String output;
Ctemplate: expandtemplate ("example. TPL", ctemplate: do_not_strip, & dict, & output );
STD: cout <output;
8. You can also specify the template encoding method by specifying autoescape:
{{% Autoescape context = "html "}}
9. There is also a lint-like development tool make_tpl_varnames_h.
Reference
[1]Http://google-ctemplate.googlecode.com/svn/trunk/doc/reference.html