Skip to content
Luke Morton edited this page Oct 22, 2011 · 1 revision

Side effects to Kohana_View

Although Beautiful View does not extend upon Kohana_View it does steal it's namespace of View. My reasons behind this are:

  • I would be happy for Kohana to incorporate this into the core and therefore it is being developed as a replacement from the outset.
  • Want all my current PHP templates to benefit from improvements via Template_PHP.
  • View makes more sense than Kostache.

You can read more into side effects by reading Beautiful_View and Template_PHP. However here are a few listed for clarity:

  • View::__construct() and View::factory() can take a Template object as their first parameter as well as a string path.
  • View::__construct() and View::factory() can take a ViewModel object as their first parameter as well as an array of data.
  • View::__construct() and View::factory() will initialise a ViewModel instance if you pass an array as the second parameter to store the data in.
  • View::__construct() and View::factory() will initialise a Template_PHP instance if you pass an array as the second parameter.
  • View::bind(), View::set() and their magic counterparts will attach data to the ViewModel. Ideally you would set data directly to the ViewModel instance however for performance reasons.
  • View::set_filename() now calls Template::set_filename().
  • View::render() now calls Template::render().
  • View::bind_global() is dropped completely because I do not care for these or your application if you use them.
  • View::render() can now accept a Template object as well as a string path.

Clone this wiki locally