Recommend this page to a friend! |
Classes of Fernando Val | Springy | documentation/en/Views.md | Download |
|
DownloadViewsAboutViews are part of MVC architecture of the framework. They are code responsible for presenting data to end users, usually files containing HTML code and special codes parsed by a template engine. In this framework you can use two different template engines: Twig or Smarty. Creating ViewsThe files with templates for the views, must be placed inside the templates directory. Each template drive uses a different suffix in file name. The files for Twig driver must end with .twig.html and the files for Smarty driver must end with .tpl.html. Sample of a template to Twig driver.
Using TemplatesOnce you have created your template file, you will need a controller to print its content. All you need is create a Springy\\Template object and use its methods. Sample how to use a template view:
If your controller extends Springy\\Controller class, you can use the protected method
|