Class Smarty_Resource_Mysqls

Description

MySQL Resource

Resource Implementation based on the Custom API to use MySQL as the storage resource for Smarty's templates and configs.

Note that this MySQL implementation fetches the source and timestamps in a single database query, instead of two seperate like resource.mysql.php does.

Table definition:

CREATE TABLE IF NOT EXISTS `templates` (
   `name` varchar(100) NOT NULL,
   `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   `source` text,
   PRIMARY KEY (`name`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Demo data:

INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');

  • author: Rodney Rehm

Located in /demo/plugins/resource.mysqls.php (line 26)

Smarty_Resource
   |
   --Smarty_Resource_Custom
      |
      --Smarty_Resource_Mysqls
Variable Summary
mixed $db
mixed $fetch
Method Summary
Smarty_Resource_Mysqls __construct ()
void fetch (string $name,  &$source,  &$mtime, string $source, integer $mtime)
Variables
Methods
Constructor __construct (line 32)
  • access: public
Smarty_Resource_Mysqls __construct ()
fetch (line 49)

Fetch a template and its modification time from database

  • access: protected
void fetch (string $name,  &$source,  &$mtime, string $source, integer $mtime)
  • string $name: template name
  • string $source: template source
  • integer $mtime: template modification timestamp (epoch)
  • &$source
  • &$mtime

Redefinition of:
Smarty_Resource_Custom::fetch()
fetch template and its modification time from data source

Inherited Methods

Inherited From Smarty_Resource_Custom

Smarty_Resource_Custom::fetch()
Smarty_Resource_Custom::fetchTimestamp()
Smarty_Resource_Custom::getBasename()
Smarty_Resource_Custom::getContent()
Smarty_Resource_Custom::populate()

Inherited From Smarty_Resource

Smarty_Resource::buildFilepath()
Smarty_Resource::config()
Smarty_Resource::fileExists()
Smarty_Resource::getBasename()
Smarty_Resource::getContent()
Smarty_Resource::load()
Smarty_Resource::populate()
Smarty_Resource::populateCompiledFilepath()
Smarty_Resource::populateTimestamp()
Smarty_Resource::source()

Documentation generated on Sat, 24 Sep 2011 20:23:18 +0200 by phpDocumentor 1.4.1