& variables Define regions of the template that we can populate with content and optionally extend with custom layouts (partials). Blocks contain default markup and may be nested. wrapper block:body block:aside block:main
(“holes”) that can be filled (“extended”) by child templates. Partials Contain chunks of template code (html markup and tags) that can be used to fill the holes in the base template(s). Models Models represent a set of data that is used by multiple templates, such as a shared fieldgroup.
shared and displayed by multiple templates. As a model’s data is intended to be reused in different views it doesn’t contain markup or display logic. Models keep you DRY (by removing boilerplate code), but increase complexity and interdependence (violating KISS). ”posts” fieldgroup blog entry page entry
this entry --} {stash:embed:models:posts process="start" parse="no"} {!-- load a custom layout for pages --} {exp:stash:extend name="block:body" with="partials:page"} singl pag
meta data for use in templates Remove conditional logic from templates Templates can assume a singular responsibility Catch incorrect and malicious URLs and 404 Inexpensive JSON/ HTML endpoints Resourc Router
2)? if ($wildcard->isValidUrlTitle(array('channel_id' => 2))) { // route to template $router->setTemplate('blog/_post'); // set {pg_entry_id} for use in template $router->setGlobal( 'pg_entry_id', $wildcard->getMeta('entry_id') ); } }, singl entr
(in group 1)? if ($wildcard->isValidCategoryUrlTitle(array('group_id' => 1))){ // route to template $router->setTemplate('blog/_category'); // set {pg_title} and {pg_intro} for use in template $router->setGlobal( 'pg_title', $wildcard->getMeta('cat_name') ); $router->setGlobal( 'pg_intro', $wildcard->getMeta('cat_description') ); } }, categor listin
Mustash Can expire after a predetermined period of time & regenerate automatically Dynamic content can be loaded via ajax Works everywhere without complex configuration Easily move up to http proxy caching with Varnish and use the same cache-breaking rules Stati cachin
{!-- static cache for one hour --} {exp:stash:static refresh="60"} {!-- apply HTML compression before caching --} {exp:stash:static compress="yes"} stati cachin