The template function is documented over here:
template
For a discussion about template vis-à-vis partial see this topic:
partial