Class Smarty_Resource_Mysql

Description

MySQL Resource

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

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.mysql.php (line 23)

Smarty_Resource
   |
   --Smarty_Resource_Custom
      |
      --Smarty_Resource_Mysql
Variable Summary
mixed $db
mixed $fetch
mixed $mtime
Method Summary
Smarty_Resource_Mysql __construct ()
void fetch (string $name,  &$source,  &$mtime, string $source, integer $mtime)
integer fetchTimestamp (string $name)
Variables
mixed $db (line 25)
  • access: protected
mixed $fetch (line 27)
  • access: protected
mixed $mtime (line 29)
  • access: protected

Inherited Variables

Inherited from Smarty_Resource

Smarty_Resource::$compileds
Smarty_Resource::$compiler_class
Smarty_Resource::$resources
Smarty_Resource::$sources
Smarty_Resource::$sysplugins
Smarty_Resource::$template_lexer_class
Smarty_Resource::$template_parser_class
Methods
Constructor __construct (line 31)
  • access: public
Smarty_Resource_Mysql __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
fetchTimestamp (line 70)

Fetch a template's modification time from database

  • return: timestamp (epoch) the template was modified
  • access: protected
integer fetchTimestamp (string $name)
  • string $name: template name

Redefinition of:
Smarty_Resource_Custom::fetchTimestamp()
Fetch template's modification timestamp 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:17 +0200 by phpDocumentor 1.4.1