Jelix 1.6.40

jZone
in package

jZone is a representation of a zone in an response content, in a html page.

A user zone should inherits from jZone. jZone provide a cache mecanism.

Tags
subpackage

utils

Table of Contents

$_cacheTimeout  : int
cache timeout (seconds).
$_cancelCache  : bool
When the cache system is activated, says if the cache should be generated or not you set it to false in _createContent or _prepareTpl, in specific case.
$_params  : array<string|int, mixed>
list of zone parameters
$_tpl  : jTpl
the jtpl object created automatically by jZone if you set up _tplname you can use it in _prepareTpl
$_tplname  : string
template selector If you want to use a template for your zone, set its name in this property in your zone, and override _prepareTpl. Else, keep it to empty string, and override _createContent
$_tplOutputType  : string
says the type of the output of the template, in the case of the result of the zone is not used in a response in the same output type.
$_useCache  : bool
If we're using cache on this zone You should override it in your class if you want activate the cache
__construct()  : mixed
constructor.
clear()  : mixed
clear a specific cache of a zone
clearAll()  : mixed
clear all zone cache or all cache of a specific zone
clearCache()  : mixed
Delete the cache of the current zone
get()  : string
get the content of a zone
getContent()  : string
get the zone content Return the cache content if it is activated and if it's exists, or call _createContent
param()  : mixed
gets the value of a parameter, if defined. Returns the default value instead.
_createContent()  : string
create the content of the zone by default, it uses a template, and so prepare a jtpl object to use in _prepareTpl.
_execMetaFunc()  : mixed
_prepareTpl()  : mixed
override this method if you want do additionnal thing on the template object Example : do access to a dao object.. Note : the template object is in the _tpl property
_callZone()  : mixed
instancy a zone object, and call one of its methods
_getCacheFiles()  : array<string|int, mixed>
Get the list of cache filenames

Properties

$_cacheTimeout

cache timeout (seconds).

protected int $_cacheTimeout = 0

set to 0 if you want to delete cache manually.

$_cancelCache

When the cache system is activated, says if the cache should be generated or not you set it to false in _createContent or _prepareTpl, in specific case.

protected bool $_cancelCache = alse

$_params

list of zone parameters

protected array<string|int, mixed> $_params

$_tpl

the jtpl object created automatically by jZone if you set up _tplname you can use it in _prepareTpl

protected jTpl $_tpl = ull

$_tplname

template selector If you want to use a template for your zone, set its name in this property in your zone, and override _prepareTpl. Else, keep it to empty string, and override _createContent

protected string $_tplname = ''

$_tplOutputType

says the type of the output of the template, in the case of the result of the zone is not used in a response in the same output type.

protected string $_tplOutputType = ''

For example, the output type of a ajax response is text, but the template can contains html, so the template should be treated as html content, so you should put 'html' here. If empty, the output type will be the output type of the current response.

Tags
see
jTpl::fetch

$_useCache

If we're using cache on this zone You should override it in your class if you want activate the cache

protected bool $_useCache = alse

Methods

__construct()

constructor.

public __construct([mixed $params = array() ]) : mixed
Parameters
$params : mixed = array()
Return values
mixed

clear()

clear a specific cache of a zone

public static clear(string $name[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
$name : string

zone selector

$params : array<string|int, mixed> = array()

parameters for the zone

Tags
since
1.0b1
Return values
mixed

clearAll()

clear all zone cache or all cache of a specific zone

public static clearAll([string $name = '' ]) : mixed
Parameters
$name : string = ''

zone selector

Tags
since
1.0b1
Return values
mixed

clearCache()

Delete the cache of the current zone

public clearCache() : mixed
Return values
mixed

get()

get the content of a zone

public static get(string $name[, array<string|int, mixed> $params = array() ]) : string
Parameters
$name : string

zone selector

$params : array<string|int, mixed> = array()

parameters for the zone

Tags
since
1.0b1
Return values
string

the generated content of the zone

getContent()

get the zone content Return the cache content if it is activated and if it's exists, or call _createContent

public getContent() : string
Return values
string

zone content

param()

gets the value of a parameter, if defined. Returns the default value instead.

public param(string $paramName[, mixed $defaultValue = null ]) : mixed
Parameters
$paramName : string

the parameter name

$defaultValue : mixed = null

the parameter default value

Return values
mixed

the param value

_createContent()

create the content of the zone by default, it uses a template, and so prepare a jtpl object to use in _prepareTpl.

protected _createContent() : string

zone parameters are automatically assigned in the template If you don't want a template, override it in your class

Return values
string

generated content

_execMetaFunc()

protected _execMetaFunc(mixed $resp, mixed $_file) : mixed
Parameters
$resp : mixed
$_file : mixed
Return values
mixed

_prepareTpl()

override this method if you want do additionnal thing on the template object Example : do access to a dao object.. Note : the template object is in the _tpl property

protected _prepareTpl() : mixed
Return values
mixed

_callZone()

instancy a zone object, and call one of its methods

private static _callZone(string $name, string $method, array<string|int, mixed> &$params) : mixed
Parameters
$name : string

zone selector

$method : string

method name

$params : array<string|int, mixed>

arguments for the method

Return values
mixed

the result returned by the method

_getCacheFiles()

Get the list of cache filenames

private _getCacheFiles([mixed $forCurrentResponse = true ]) : array<string|int, mixed>
Parameters
$forCurrentResponse : mixed = true
Return values
array<string|int, mixed>

list of filenames

Search results