Docs: Template API

The Template API

Every call a tilspire theme can make, in seven parts. Start here: how each call returns its text, and what it does when nothing is found.

Everything a theme's view may ask of tilspire is a method on $this. You read content, the site and the request through these calls, never through SQL, page_data, $_SESSION or $_GET. A query of your own forgets drafts and translations, and bypasses the page cache's rules.

How text comes back #

  • E, escaped. Echo it as it is. Never pass it through htmlspecialchars() again.
  • P, plain. Escape it as you print it: htmlspecialchars($v, ENT_QUOTES, 'UTF-8').
  • M, markup. Core cleaned it when it was saved, or built it. Echo it as it is.

Nothing throws on a public page. A list that cannot be built is empty, and a lookup that finds nothing is null or an empty string. A shape may gain keys in 1.x. A key is never removed or given another type.