Wordless
Stop writing themes like it's 1998.
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

◆ get_partial_content()

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

◆ render_error()

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

◆ render_partial()

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 partial filenames (those starting with an underscore by convention)
array$localsAn associative array. Keys will be variables' names and values will be variable values inside the partial

◆ render_template()

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

◆ render_view()

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

◆ wl_yield()

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()