How to Create a Template

See Help:Template, as well as its reference to advanced templates.