Interface Sugar_StorageDriver

Description

Storage driver interface.

Interface for storage drivers. These are used to load template from different resources, such as the file system or a database.

Located in /Sugar/StorageDriver.php (line 56)


	
			
Method Summary
mixed getHandle (string $name)
int getLastModified (mixed $handle)
string getName (mixed $handle, string $name)
string getSource (mixed $handle)
Methods
getHandle (line 83)

Search for the template and return a driver-specific handle.

Given a reference to a template, look up the template and return a drive specific handle. This handle may be anything, including an object, a string, an array, or an integer. The value FALSE is returned to indicate that the template does not exist or cannot be found.

The File storage driver, as an example, simply returns the full path to the template, or FALSE if the template cannot be found.

The handle will be passed to the other storage driver methods for loading data or checking timestamps.

Note that, depending on the driver, it may be possible for a template to be found when getHandle() is called, and thus have a valid handle, but then be deleted or removed before an other methods are called. Fault-tolerant drivers should be prepared.

  • return: Driver-specific handle, or FALSE if the template cannot be found.
  • access: public
mixed getHandle (string $name)
  • string $name: Name of the template to look up.
getLastModified (line 92)

Returns the timestamp of the handle.

  • return: Timestamp if it exists, or zero if it cannot be found.
  • access: public
int getLastModified (mixed $handle)
  • mixed $handle: Handle returned by getHandle().
getName (line 127)

Returns a user-friendly name for the handle.

The purpose of this function is to provide the most user-friendly name for a handle that is possible. If in doubt, simply return the $name parameter.

For an example, the File driver returns the $handle parameter, as this is the full path of the template. The full path is the most user-friendly name, as it identifies where the specific template is. The name alone may be ambiguous if there are multiple template directories.

The returned value should help the user get to the template easily and quickly. It may be useful for some drivers in CMS systems to return a URL to the edit page for the requested template, for instance.

  • return: User-friendly name for the handle.
  • access: public
string getName (mixed $handle, string $name)
  • mixed $handle: Handle returned by getHandle().
  • string $name: Name of the template requested.
getSource (line 101)

Returns the source for the handle.

  • return: Source of handle.
  • access: public
string getSource (mixed $handle)
  • mixed $handle: Handle to lookup.

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