negative(-11) Documentation

Documentation Home

Templates

Templates contain markup and display logic. Their sole purpose is to render output for the end user. A Controller instantiates, and supplies data to, a template via the View_Component. Here is an example of how a template is rendered:

// The following line loads a template named my_view_name.php from the /views folder in system or a package. 
$view = new View_Component('my_view_name');
$view->variable = 'something';

// This call is not necessary if $auto_draw member is set to TRUE in the controller.
$view->display_content();	

Templates vs. Views

In many other web frameworks, our templates would be called 'views.' The reason we do not do that, is because the term 'view' implies the layer that the user is interacting with. In stateless web transactions, no such layer exists. Instead, we have a View_Component class that is used to negotiate the templates and to generate the necessary output for the end user. It is this output that the user interacts with, not the template itself. It is a minor semantic difference that we have elected to employ!


© Copyright 2010 negative11.com