Properties

$suppressNocacheProcessing

$suppressNocacheProcessing : boolean

suppress generation of nocache code

Type

boolean

$suppressMergedTemplates

$suppressMergedTemplates : boolean

suppress generation of merged template code

Type

boolean

$_tag_objects

$_tag_objects : array

compile tag objects

Type

array

$_tag_stack

$_tag_stack : array

tag stack

Type

array

$merged_templates

$merged_templates : array

merged templates

Type

array

$inheritance

$inheritance : boolean

flag when compiling {block}

Type

boolean

$default_handler_plugins

$default_handler_plugins : array

plugins loaded by default plugin handler

Type

array

$default_modifier_list

$default_modifier_list : mixed

saved preprocessed modifier list

Type

mixed

$forceNocache

$forceNocache : boolean

force compilation of complete template as nocache

Type

boolean

$suppressHeader

$suppressHeader : boolean

suppress Smarty header code in compiled template

Type

boolean

$suppressTemplatePropertyHeader

$suppressTemplatePropertyHeader : boolean

suppress template property header code in compiled template

Type

boolean

$write_compiled_code

$write_compiled_code : boolean

flag if compiled template file shall we written

Type

boolean

$compiles_template_function

$compiles_template_function : boolean

flag if currently a template function is compiled

Type

boolean

$called_functions

$called_functions : array

called subfuntions from template function

Type

array

$modifier_plugins

$modifier_plugins : array

flags for used modifier plugins

Type

array

$lexer_class

$lexer_class : string

Lexer class name

Type

string

$parser_class

$parser_class : string

Parser class name

Type

string

$lex

$lex : object

Lexer object

Type

object

$parser

$parser : object

Parser object

Type

object

$smarty

$smarty : object

Smarty object

Type

object

$local_var

$local_var : array

array of vars which can be compiled in local scope

Type

array

$nocache_hash

$nocache_hash : mixed

hash for nocache sections

Type

mixed

Methods

__construct()

__construct(string  $lexer_class, string  $parser_class, \Smarty  $smarty) 

Initialize compiler

Parameters

string $lexer_class

class name

string $parser_class

class name

\Smarty $smarty

global instance

compileTemplate()

compileTemplate(\Smarty_Internal_Template  $template) : boolean

Method to compile a Smarty template

Parameters

\Smarty_Internal_Template $template

template object to compile

Returns

boolean —

true if compiling succeeded, false if it failed

compileTag()

compileTag(string  $tag, array  $args, array  $parameter = array()) : string

Compile Tag

This is a call back from the lexer/parser It executes the required compile plugin for the Smarty tag

Parameters

string $tag

tag name

array $args

array with tag attributes

array $parameter

array with compilation parameter

Returns

string —

compiled code

callTagCompiler()

callTagCompiler(string  $tag, array  $args, mixed  $param1 = null, mixed  $param2 = null, mixed  $param3 = null) : string

lazy loads internal compile plugin for tag and calls the compile methode

compile objects cached for reuse. class name format: Smarty_Internal_Compile_TagName plugin filename format: Smarty_Internal_Tagname.php

Parameters

string $tag

tag name

array $args

list of tag attributes

mixed $param1

optional parameter

mixed $param2

optional parameter

mixed $param3

optional parameter

Returns

string —

compiled code

getPlugin()

getPlugin(  $plugin_name, string  $plugin_type) : string

Check for plugins and return function name

Parameters

$plugin_name
string $plugin_type

type of plugin

Returns

string —

call name of function

getPluginFromDefaultHandler()

getPluginFromDefaultHandler(string  $tag, string  $plugin_type) : boolean

Check for plugins by default plugin handler

Parameters

string $tag

name of tag

string $plugin_type

type of plugin

Returns

boolean —

true if found

processNocacheCode()

processNocacheCode(string  $content, boolean  $is_code) : string

Inject inline code for nocache template sections

This method gets the content of each template element from the parser. If the content is compiled code and it should be not cached the code is injected into the rendered output.

Parameters

string $content

content of template element

boolean $is_code

true if content is compiled code

Returns

string —

content

trigger_template_error()

trigger_template_error(string  $args = null, string  $line = null) 

display compiler error messages without dying

If parameter $args is empty it is a parser detected syntax error. In this case the parser is called to obtain information about expected tokens.

If parameter $args contains a string this is used as error message

Parameters

string $args

individual error message or null

string $line

line-number

Throws

\SmartyCompilerException

when an unexpected token is found

doCompile()

doCompile(mixed  $_content) : boolean

Methode to compile a Smarty template

Parameters

mixed $_content

template source

Returns

boolean —

true if compiling succeeded, false if it failed