Skip to content
jdp edited this page Sep 13, 2010 · 3 revisions

It wouldn’t be very good practice to mix up all of our logic and presentation, and that’s why Tessera supports views and layouts. They’re also both completely optional, how is Tessera supposed to know what kind of application you’ve made? Maybe all it does is echo JSON, you probably wouldn’t need any views or layouts for that.

Using Views

A view is included if it exists. Both views and layouts are stored in the views directory relative to the application’s PHP file, and the name of the view is method_name.html. For example, the route ‘/foo/bar’ => ‘foo’ would have the view views/foo.html. That’s not forced though, you can change the name of the view you use. In the method, call $this->view = 'viewname' to use views/viewname.html. If you don’t want to use a view, but the file exists, just call $this->view = null to turn it off.

Clone this wiki locally