Controllers
Controllers are registered with the controllers
extension.
Callback definition
The controllers
extension accepts an array of controllers where the key is the name of the associated template and the value a callback function that returns an array of variables for your template.
You can now use the $articles
variable in your blog template.
File definition
Alternatively, you can require a file. The required file would be a controller with a function that returns an array of variables for your template.
Usage in templates
You can directly use the defined variables in the related template.