Class Sugar_Template

Description

Template instance object.

Encapsulates all operations to be performed for a particular template.

Located in /Sugar/Template.php (line 51)


	
			
Variable Summary
string $cacheId
string $name
Method Summary
Sugar_Template __construct (Sugar $sugar, Sugar_StorageDriver $storage, mixed $handle, string $name, string $cacheId)
void display ([Sugar_Context $context = null])
string fetch ([Sugar_Context $context = null])
Sugar_Context getContext ()
string getName ()
string getSource ()
bool isCached ()
void set (string $name, mixed $value)
void setInherit (string $file)
Variables
string $cacheId (line 72)

Cache identifier.

  • access: public
string $name (line 65)

Name of the template as given by the user.

  • access: public
Sugar $sugar (line 58)

Our Sugar instance

  • access: public
Methods
Constructor __construct (line 129)

Constructor.

  • access: public
Sugar_Template __construct (Sugar $sugar, Sugar_StorageDriver $storage, mixed $handle, string $name, string $cacheId)
  • Sugar $sugar: Sugar object.
  • Sugar_StorageDriver $storage: Storage driver.
  • mixed $handle: Storage driver handle.
  • string $name: Name of template requested by user.
  • string $cacheId: The cache ID for the reference.
display (line 326)

Display the template

  • access: public
void display ([Sugar_Context $context = null])
  • Sugar_Context $context: Optional context to use instead of the default local context
fetch (line 422)

Fetch template output as a string

  • access: public
string fetch ([Sugar_Context $context = null])
  • Sugar_Context $context: Optional context to use instead of the default local context
getContext (line 175)

Get the template's local variable context

  • access: public
Sugar_Context getContext ()
getLastModified (line 145)

Get the last-modified timestamp of the template.

  • return: Last-modified timestamp.
  • access: public
int getLastModified ()
getName (line 165)

Get a user-friendly name for the template

  • return: User-friendly template name.
  • access: public
string getName ()
getSource (line 155)

Get the source code of the template.

  • return: Source code of the template.
  • access: public
string getSource ()
isCached (line 257)

Check if the template has a valid and completely up-to-date ache.

This will check the cache status of included templates as well.

  • return: True for a valid cache, false if missing or outdated.
  • access: public
bool isCached ()
set (line 268)

Helper to set a variable in the template's local context

  • access: public
void set (string $name, mixed $value)
  • string $name: Name of variable to set
  • mixed $value: Value of variable
setInherit (line 186)

Set the inherited template, which overrides any inherited template specified in the template source.

  • access: public
void setInherit (string $file)
  • string $file: Template to inherit from

Documentation generated on Sat, 18 Sep 2010 05:27:02 +0000 by phpDocumentor 1.4.3