Wordless
Stop writing themes like it's 1998.
 All Classes Namespaces Functions Variables Modules Pages
Public Member Functions | List of all members
RenderHelper Class Reference

Handles rendering of views, templates, partials. More...

Public Member Functions

 render_error ($title, $description)
 Renders a preformatted error display view than dies. More...
 
 render_template ($name, $locals=array())
 Renders a template and its contained plartials. More...
 
 get_partial_content ($name, $locals=array())
 Retrievs contents of partial without printing theme. More...
 
 render_partial ($name, $locals=array())
 Renders a partial: those views followed by an underscore by convention. More...
 
 wl_yield ()
 Yield is almost inside every good templates. More...
 
 render_view ($name, $layout= 'default', $locals=array())
 Renders a view. More...
 

Detailed Description

Handles rendering of views, templates, partials.

Member Function Documentation

RenderHelper::get_partial_content (   $name,
  $locals = array() 
)

Retrievs contents of partial without printing theme.

Parameters
string$nameThe template filenames (those not starting with an underscore by convention)
array$localsAn associative array. Keys will be variables' names and values will be variable values inside the partial
RenderHelper::render_error (   $title,
  $description 
)

Renders a preformatted error display view than dies.

Parameters
string$titleA title for the error
string$descriptionAn explanation about the error
RenderHelper::render_partial (   $name,
  $locals = array() 
)

Renders a partial: those views followed by an underscore by convention.

Partials are inside theme/views.

Parameters
string$nameThe template filenames (those not starting with an underscore by convention)
array$localsAn associative array. Keys will be variables' names and values will be variable values inside the partial
RenderHelper::render_template (   $name,
  $locals = array() 
)

Renders a template and its contained plartials.

Accepts a list of locals variables which will be available inside the code of the template

Parameters
string$nameThe template filenames (those not starting with an underscore by convention)
array$localsAn associative array. Keys will be variables' names and values will be variable values inside the template
See also
php.bet/extract
RenderHelper::render_view (   $name,
  $layout = 'default',
  $locals = array() 
)

Renders a view.

Views are rendered based on the routing. They will show a template and a yielded content based on the user requested page.

Parameters
string$nameFilename with path relative to theme/views
string$layoutThe template to use to render the view
array$localsAn associative array. Keys will be variables' names and values will be variable values inside the view
RenderHelper::wl_yield ( )

Yield is almost inside every good templates.

Based on the rendering view yield() will insert inside the template the specific required content (usually called partials)

See also
render_view()
render_template()