Documentation

Stream extends AbstractTemplate
in package

View stream template class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
5.0.0

Table of Contents

Properties

$blocks  : array<string|int, mixed>
Block templates
$cacheDir  : string|null
Cache directory for compiled templates
$contributingFiles  : array<string|int, mixed>
Files that contributed to the resolved template (path => mtime), across the full @extends/@include chain
$data  : array<string|int, mixed>
View data
$file  : string|null
View template file
$master  : string|null
Master template
$masterBlocks  : array<string|int, mixed>
Master block templates
$output  : string|null
View output string
$parent  : Stream|null
View parent template
$template  : string|null
View template

Methods

__construct()  : mixed
Constructor
getBlock()  : string|null
Get block by name
getBlocks()  : array<string|int, mixed>
Get blocks
getCacheDir()  : string|null
Get cache directory
getContributingFiles()  : array<string|int, mixed>
Get files (path => mtime) that contributed to the resolved template
getMaster()  : string
Get master
getMasterBlock()  : string|null
Get master block by name
getMasterBlocks()  : array<string|int, mixed>
Get master blocks
getParent()  : self|null
Get parent
getTemplate()  : string
Get view template
hasCacheDir()  : bool
Has a cache directory been configured
isFile()  : bool
Determine if the template stream is from a file
isString()  : bool
Determine if the template stream is from a string
render()  : string
Render the view and return the output
setBlock()  : static
Set block
setBlocks()  : static
Set blocks
setCacheDir()  : static
Set cache directory for compiled templates
setMaster()  : static
Set master
setMasterBlock()  : static
Set master block
setMasterBlocks()  : static
Set master blocks
setTemplate()  : static
Set view template with auto-detect
assertSafeTemplatePath()  : void
Guard against path traversal / absolute-path escapes in @extends/@include targets
parseBlocks()  : void
Parse template parent/child blocks
parseIncludes()  : void
Parse template includes
parseParent()  : void
Parse template parent/child blocks
renderCompiled()  : void
Render the view template string via the compiled/cached path
renderTemplate()  : void
Render view template string

Properties

$blocks

Block templates

protected array<string|int, mixed> $blocks = []

$cacheDir

Cache directory for compiled templates

protected string|null $cacheDir = null

$contributingFiles

Files that contributed to the resolved template (path => mtime), across the full @extends/@include chain

protected array<string|int, mixed> $contributingFiles = []

$file

View template file

protected string|null $file = null

$master

Master template

protected string|null $master = null

$masterBlocks

Master block templates

protected array<string|int, mixed> $masterBlocks = []

$parent

View parent template

protected Stream|null $parent = null

Methods

__construct()

Constructor

public __construct(string $template[, string|null $cacheDir = null ]) : mixed

Instantiate the view stream template object

Parameters
$template : string
$cacheDir : string|null = null

getBlock()

Get block by name

public getBlock(string $name) : string|null
Parameters
$name : string
Return values
string|null

getBlocks()

Get blocks

public getBlocks() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCacheDir()

Get cache directory

public getCacheDir() : string|null
Return values
string|null

getContributingFiles()

Get files (path => mtime) that contributed to the resolved template

public getContributingFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMaster()

Get master

public getMaster() : string
Return values
string

getMasterBlock()

Get master block by name

public getMasterBlock(string $name) : string|null
Parameters
$name : string
Return values
string|null

getMasterBlocks()

Get master blocks

public getMasterBlocks() : array<string|int, mixed>
Return values
array<string|int, mixed>

getParent()

Get parent

public getParent() : self|null
Return values
self|null

getTemplate()

Get view template

public getTemplate() : string
Return values
string

hasCacheDir()

Has a cache directory been configured

public hasCacheDir() : bool
Return values
bool

isFile()

Determine if the template stream is from a file

public isFile() : bool
Return values
bool

isString()

Determine if the template stream is from a string

public isString() : bool
Return values
bool

render()

Render the view and return the output

public render([array<string|int, mixed>|null $data = null ]) : string
Parameters
$data : array<string|int, mixed>|null = null
Return values
string

setBlock()

Set block

public setBlock(string $name, string $value) : static
Parameters
$name : string
$value : string
Return values
static

setBlocks()

Set blocks

public setBlocks(array<string|int, mixed> $blocks) : static
Parameters
$blocks : array<string|int, mixed>
Return values
static

setCacheDir()

Set cache directory for compiled templates

public setCacheDir(string $dir) : static
Parameters
$dir : string
Return values
static

setMaster()

Set master

public setMaster(string $master) : static
Parameters
$master : string
Return values
static

setMasterBlock()

Set master block

public setMasterBlock(string $name, string $value) : static
Parameters
$name : string
$value : string
Return values
static

setMasterBlocks()

Set master blocks

public setMasterBlocks(array<string|int, mixed> $blocks) : static
Parameters
$blocks : array<string|int, mixed>
Return values
static

setTemplate()

Set view template with auto-detect

public setTemplate(string $template) : static
Parameters
$template : string
Return values
static

assertSafeTemplatePath()

Guard against path traversal / absolute-path escapes in @extends/@include targets

protected static assertSafeTemplatePath(string $tmpl) : void
Parameters
$tmpl : string
Tags
throws
Exception

parseBlocks()

Parse template parent/child blocks

protected parseBlocks() : void

parseIncludes()

Parse template includes

protected parseIncludes() : void

parseParent()

Parse template parent/child blocks

protected parseParent() : void

renderCompiled()

Render the view template string via the compiled/cached path

protected renderCompiled() : void

renderTemplate()

Render view template string

protected renderTemplate() : void

        
On this page

Search results