class vB5_Template

This class is a simplified version of the one implemented in includes/class_core.php

Constants

WIDGET_ERROR_TEMPLATE

Properties

protected string $template Name of the template to render
protected array $registered Array of registered variables.
static protected array $globalRegistered Array of global registered variables.
static protected array $renderedTemplates List of templates rendered (for debugging output)
static protected $renderedTemplateNames
static protected $renderedTemplatesStack
static protected $jQueryUrl

Methods

__construct($templateName)

Constructor

bool
register(string $name, mixed $value, bool $overwrite = true)

Register a variable with the template.

bool
registerGlobal(string $name, mixed $value, bool $overwrite = true)

Register a global variable with the template.

bool
isRegistered(string $name)

Determines if a named variable is registered.

bool
isGlobalRegistered(string $name)

Determines if a named variable is global registered.

registerjQuery()

No description

registerDefaultGlobals()

Globally registers the default variables that are globally available to all templates.

string
render(boolean $isParentTemplate = true, boolean $isAjaxTemplateRender = false)

Renders the output after preperation.

static 
handlePreRenderDebugInfo(string $templateName, bool $isParentTemplate)

Handles storing the debug info about templates that have been rendered. Called PRE-render.

static 
handlePostRenderDebugInfo()

Handles storing the debug info about templates that have been rendered. Called POST-render.

static string
addDebugTemplateName(string $final_rendered, string $templateName)

Adds the template name as an HTML comment for debugging purposes

string
renderDelayed(string $final_rendered_orig, boolean $isAjaxTemplateRender = false)

Handle any delayed rendering. Currently delayed urls and node texts.

array
getIncludedFileInfo()

Returns the included file information used by renderDelayed for the debug_info template

static array
getAutoloadInfo()

Returns debug autoload info

static 
getRenderedTemplates()

No description

static string
staticRender(string $templateName, array $data = array(), bool $isParentTemplate = true, bool $isAjaxTemplateRender = false)

Returns a string containing the rendered template

static string
staticRenderAjax(string $templateName, array $data = array())

Returns a string containing the rendered template

Details

at line 60
__construct($templateName)

Constructor

Parameters

$templateName

at line 77
bool register(string $name, mixed $value, bool $overwrite = true)

Register a variable with the template.

Global registered variables are available in main templates and child templates included with {vb:template}

Parameters

string $name Name of the variable to be registered
mixed $value Value to be registered. This may be a scalar or an array.
bool $overwrite Whether to overwrite existing vars

Return Value

bool Whether the var was registered

at line 97
bool registerGlobal(string $name, mixed $value, bool $overwrite = true)

Register a global variable with the template.

Parameters

string $name Name of the variable to be registered
mixed $value Value to be registered. This may be a scalar or an array.
bool $overwrite Whether to overwrite existing vars

Return Value

bool Whether the var was registered

at line 115
bool isRegistered(string $name)

Determines if a named variable is registered.

Parameters

string $name Name of variable to check

Return Value

bool

at line 126
bool isGlobalRegistered(string $name)

Determines if a named variable is global registered.

Parameters

string $name Name of variable to check

Return Value

bool

at line 131
protected registerjQuery()

at line 178
protected registerDefaultGlobals()

Globally registers the default variables that are globally available to all templates.

at line 323
string render(boolean $isParentTemplate = true, boolean $isAjaxTemplateRender = false)

Renders the output after preperation.

Parameters

boolean $isParentTemplate Whether to suppress the HTML comment surrounding option (for JS, etc)
boolean $isAjaxTemplateRender true if we are rendering for a call to /ajax/render/ and we want CSS s separate

Return Value

string

See also

vB5_Template::render

at line 429
static protected handlePreRenderDebugInfo(string $templateName, bool $isParentTemplate)

Handles storing the debug info about templates that have been rendered. Called PRE-render.

Parameters

string $templateName Template name
bool $isParentTemplate Is this a parent template

at line 448
static protected handlePostRenderDebugInfo()

Handles storing the debug info about templates that have been rendered. Called POST-render.

at line 465
static string addDebugTemplateName(string $final_rendered, string $templateName)

Adds the template name as an HTML comment for debugging purposes

Parameters

string $final_rendered (reference) The rendered HTML
string $templateName The template name.

Return Value

string The rendered HTML with an HTML comment before/after, indicating the template name

at line 482
protected string renderDelayed(string $final_rendered_orig, boolean $isAjaxTemplateRender = false)

Handle any delayed rendering. Currently delayed urls and node texts.

Parameters

string $final_rendered_orig
boolean $isAjaxTemplateRender true if we are rendering for a call to /ajax/render/ and we want CSS s separate

Return Value

string

at line 572
protected array getIncludedFileInfo()

Returns the included file information used by renderDelayed for the debug_info template

Return Value

array Array containing 'files' and 'count'.

at line 603
static array getAutoloadInfo()

Returns debug autoload info

Return Value

array Array of debug info containing 'classes' and 'count'

at line 656
static getRenderedTemplates()

at line 671
static string staticRender(string $templateName, array $data = array(), bool $isParentTemplate = true, bool $isAjaxTemplateRender = false)

Returns a string containing the rendered template

Parameters

string $templateName
array $data
bool $isParentTemplate
bool $isAjaxTemplateRender
  • true if we are rendering for a call to /ajax/render/ and we want CSS s separate

Return Value

string

See also

vB5_Frontend_Controller_Ajax::actionRender
vB5_Frontend_Controller_Page::renderTemplate

at line 699
static string staticRenderAjax(string $templateName, array $data = array())

Returns a string containing the rendered template

Parameters

string $templateName
array $data

Return Value

string

See also

vB5_Frontend_Controller_Ajax::actionRender