Read this guide first. Core dna is hosted, so there is nothing to install; your repository holds only templates and front-end assets; and a new kind of page starts in the admin, with a layout. In half a day, from what the platform is to a page you built, deployed and rendered in Smarty or Twig.
L0
Unit 04 · From URL to rendered page
Inspecting a render
From URL to rendered pagePage 25 of 28Updated
How to see what a template received and why a page came out wrong: debug_vars in both engines on a development environment, the error page and the admin's Template Errors list, and what the usual surprises, from Template not found to a blank space, mean.
Who this is for. Theme developers with a page that does not render as expected. After this page you can look inside a render instead of guessing, and read the common symptoms.
Seeing values with debug_vars
debug_vars records the values you pass it, and the platform shows them in a panel fixed to the bottom of the page, each labelled with where it was called. It works only on an environment in development mode; anywhere else it does nothing, so a call left in a template is harmless on production. Remove it anyway once you have your answer.
When you pass more than one value, each is labelled: in Smarty with the name you give it, page and heading above, and in Twig with a number, in the order given. Twig also accepts it as a filter, {{ page|debug_vars }}. The panel is added only to an HTML page; on a JSON response the values are added to the JSON instead.
When a template fails
On a development environment, an error in a template shows a full error page, with the message and a stack trace that leads to the template and line.
On production, the visitor gets status 500 and the site's own templates/errors/fatal-error.html, or the platform's if the site has none. The error itself is recorded, and errors from public pages are listed in the admin under System › Sites › Template Errors.
So an error you cannot reproduce on development is first looked for in Template Errors, not by adding output to the live template.
What an unexpected page usually means
You see
It usually means
Only the line Template not found: <path>, with status 200 (Smarty)
The layout's template path and the files on the server disagree, or the file was not deployed
The site's header and footer with nothing between
The page template's block has a name the base template does not use, so its content is dropped. Compare the block names
A blank space where a component should be
The component's layout names no template, its template prints nothing for this content, or an area name is wrong
A field the editor filled in does not appear
The area name in the template is not the layout's: a wrong name prints nothing
Error: cannot get text content for area of type …
getAreaText() was used on an area that is not text, such as an image
A 404 for a page you can see in the admin
It is unpublished or scheduled, or you are looking while signed in, where unpublished pages show. Check in a private window