jZone

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.

package

jelix

subpackage

utils

Methods

constructor.

__construct( $params = array()) 

Arguments

$params

instancy a zone object, and call one of its methods

_callZone(string $name, string $method, array &$params) : mixed
static

Arguments

$name

string

zone selector

$method

string

method name

$params

array

arguments for the method

Response

mixed

the result returned by the method

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

_createContent() : string

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

Response

string

generated content

_execMetaFunc

_execMetaFunc( $resp,  $_file) 

Arguments

$resp

$_file

Get the list of cache filenames

_getCacheFiles( $forCurrentResponse = true) : array

Arguments

$forCurrentResponse

Response

array

list of filenames

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

_prepareTpl() 

. Note : the template object is in the _tpl property

clear a specific cache of a zone

clear(string $name, array $params = array()) 
static
since 1.0b1

Arguments

$name

string

zone selector

$params

array

parameters for the zone

clear all zone cache or all cache of a specific zone

clearAll(string $name = '') 
static
since 1.0b1

Arguments

$name

string

zone selector

Delete the cache of the current zone

clearCache() 

get the content of a zone

get(string $name, array $params = array()) : string
static
since 1.0b1

Arguments

$name

string

zone selector

$params

array

parameters for the zone

Response

string

the generated content of the zone

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

getContent() : string

Response

string

zone content

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

param(string $paramName, mixed $defaultValue = null) : mixed

Arguments

$paramName

string

the parameter name

$defaultValue

mixed

the parameter default value

Response

mixed

the param value

Properties

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

_useCache : boolean
var

Type(s)

boolean

cache timeout (seconds).

_cacheTimeout : integer

set to 0 if you want to delete cache manually.

var

Type(s)

integer

list of zone parameters

_params : array
var

Type(s)

array

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

_tplname : string
var

Type(s)

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.

_tplOutputType : string

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.

var
see

Type(s)

string

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

_tpl : \jTpl
var

Type(s)

\jTpl

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.

_cancelCache : boolean
var

Type(s)

boolean