ZenMagick 0.9.8


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

Class ZMSavant

Savant3
└─ZMSavant

public class ZMSavant
extends Savant3

Custom Savant(3).

Adds some convenience methods to access resources.

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:

get($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, $result)
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
Version:
$Id: ZMSavant.php 2779 2009-12-24 00:44:00Z dermanomann $

Constructor Summary

ZMSavant(mixed config)

Create a new instance.

Method Summary
string

asUrl(string filename)

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

boolean

exists(string filename)

Check if the given resource file exists.

void

fetch(mixed tpl)

{@inheritDoc} Adds a hook for flexible caching.

string

path(string filename)

Resolve the given resource filename to a fully qualified filename.

Constructor Detail

\mvc\view\ZMSavant.php at line 55

ZMSavant

public ZMSavant(mixed config)

Create a new instance.


Method Detail

\mvc\view\ZMSavant.php at line 101

asUrl

public string asUrl(string filename)

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

Parameters:
filename - The filename, relative to the template path.
Returns:
A url.

\mvc\view\ZMSavant.php at line 80

exists

public boolean exists(string filename)

Check if the given resource file exists.

Parameters:
filename - The filename, relative to the template path.
Returns:
true if the file exists, false if not.

\mvc\view\ZMSavant.php at line 119

fetch

public void fetch(mixed tpl)

Adds a hook for flexible caching.


\mvc\view\ZMSavant.php at line 90

path

public string path(string filename)

Resolve the given resource filename to a fully qualified filename.

Parameters:
filename - The filename, relative to the template path.
Returns:
A fully qualified filename or null.

ZenMagick 0.9.8