Skip to content

Smarty_Internal_Runtime_Inheritance

Inheritance Runtime Methods processBlock, endChild, init

  • Full name: \Smarty_Internal_Runtime_Inheritance

Properties

state

State machine - 0 idle next extends will create a new inheritance tree - 1 processing child template - 2 wait for next inheritance template - 3 assume parent template, if child will loaded goto state 1 a call to a sub template resets the state to 0

public int $state

childRoot

Array of root child {block} objects

public \Smarty_Internal_Block[] $childRoot

inheritanceLevel

inheritance template nesting level

public int $inheritanceLevel

tplIndex

inheritance template index

public int $tplIndex

sources

Array of template source objects

public \Smarty_Template_Source[] $sources

sourceStack

Stack of source objects while executing block code

public \Smarty_Template_Source[] $sourceStack

Methods

init

Initialize inheritance

public init(\Smarty_Internal_Template $tpl, bool $initChild, array $blockNames = array()): mixed

Parameters:

Parameter Type Description
$tpl \Smarty_Internal_Template template object of caller
$initChild bool if true init for child template
$blockNames array outer level block name

endChild

End of child template(s) - if outer level is reached flush output buffer and switch to wait for parent template state

public endChild(\Smarty_Internal_Template $tpl, null|string $template = null, null|string $uid = null, null|string $func = null): mixed

Parameters:

Parameter Type Description
$tpl \Smarty_Internal_Template
$template null|string optional name of inheritance parent template
$uid null|string uid of inline template
$func null|string function call name of inline template

Throws:


instanceBlock

Smarty_Internal_Block constructor.

public instanceBlock(\Smarty_Internal_Template $tpl, mixed $className, string $name, int|null $tplIndex = null): mixed
  • if outer level {block} of child template ($state === 1) save it as child root block
  • otherwise process inheritance and render

Parameters:

Parameter Type Description
$tpl \Smarty_Internal_Template
$className mixed
$name string
$tplIndex int|null index of outer level {block} if nested

Throws:


process

Goto child block or render this

public process(\Smarty_Internal_Template $tpl, \Smarty_Internal_Block $block, \Smarty_Internal_Block|null $parent = null): mixed

Parameters:

Parameter Type Description
$tpl \Smarty_Internal_Template
$block \Smarty_Internal_Block
$parent \Smarty_Internal_Block|null

Throws:


callChild

Render child on \$smarty.block.child

public callChild(\Smarty_Internal_Template $tpl, \Smarty_Internal_Block $block): null|string

Parameters:

Parameter Type Description
$tpl \Smarty_Internal_Template
$block \Smarty_Internal_Block

Return Value:

block content

Throws:


callParent

Render parent block on \$smarty.block.parent or {block append/prepend}

public callParent(\Smarty_Internal_Template $tpl, \Smarty_Internal_Block $block, string $tag): null|string

Parameters:

Parameter Type Description
$tpl \Smarty_Internal_Template
$block \Smarty_Internal_Block
$tag string

Return Value:

block content

Throws:


callBlock

render block

public callBlock(\Smarty_Internal_Block $block, \Smarty_Internal_Template $tpl): mixed

Parameters:

Parameter Type Description
$block \Smarty_Internal_Block
$tpl \Smarty_Internal_Template


Automatically generated on 2025-03-18