ZenMagick 0.9.10


org.zenmagick.mvc.view\ZMSavant
mvc\view\ZMSavant.php at line 49

Class ZMSavant

Savant3
└─ZMSavant

public class ZMSavant
extends Savant3

Custom Savant(3).

Adds some convenience methods to access templates.

ATTENTION: These methods only make sense if called from within a template.

Also, adds support for caching. The config map supports a key cache that is expected to be a class name that implements the following two methods:

lookup($tpl)
Query the cache for the given template name and return the cached contents (if any). If the template is not cached (yet), or is not allowed to be cached, null should be returned.
save($tpl, $contents)
Save the contents of the given template fetch in the cache (if allowed).

It should be noted that it is the reponsibility of the cache class to decide whether a given template can be cached or not.

Author:
DerManoMann

Method Summary
void

__construct(mixed config)

Create a new instance.

string

asUrl(string filename, string type)

Resolve the given (relative) templates filename into a url.

string

block(string blockId, array args)

Call the block handler for the given block id.

boolean

exists(string filename, string type)

Check if the given template/resource file exists.

void

fetch(mixed tpl)

{@inheritDoc} Adds a hook for flexible caching.

string

path(string filename, string type)

Resolve the given templates filename to a fully qualified filename.

Method Detail

mvc\view\ZMSavant.php at line 54

__construct

public void __construct(mixed config)

Create a new instance.


mvc\view\ZMSavant.php at line 109

asUrl

public string asUrl(string filename, string type)

Resolve the given (relative) templates filename into a url.

Parameters:
filename - The filename, relative to the template path.
type - The lookup type; valid values are ZMView::TEMPLATE and ZMView::RESOURCE; default is ZMVIew::TEMPLATE.
Returns:
A url.

mvc\view\ZMSavant.php at line 161

block

public string block(string blockId, array args)

Call the block handler for the given block id.

All registered block contents that is found at this time will be returned as ready-to-use HTML.

Parameters:
blockId - The block id.
args - Optional parameter; default is an empty array.
Returns:
The HTML content for this block.

mvc\view\ZMSavant.php at line 84

exists

public boolean exists(string filename, string type)

Check if the given template/resource file exists.

Parameters:
filename - The filename, relative to the template path.
type - The lookup type; valid values are ZMView::TEMPLATE and ZMView::RESOURCE; default is ZMVIew::TEMPLATE.
Returns:
true if the file exists, false if not.

mvc\view\ZMSavant.php at line 132

fetch

public void fetch(mixed tpl)

Adds a hook for flexible caching.


mvc\view\ZMSavant.php at line 96

path

public string path(string filename, string type)

Resolve the given templates filename to a fully qualified filename.

Parameters:
filename - The filename, relative to the template path.
type - The lookup type; valid values are ZMView::TEMPLATE and ZMView::RESOURCE; default is ZMVIew::TEMPLATE.
Returns:
A fully qualified filename or null.

ZenMagick 0.9.10