extends |
Smarty_Resource_Custom |
---|
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}');
Methods | ||||||||
---|---|---|---|---|---|---|---|---|
public
|
__construct()
Smarty_Resource_Mysql constructor.
|
# | ||||||
protected
|
fetch(string $name, string &$source, integer &$mtime): void
Fetch a template and its modification time from database
Fetch a template and its modification time from database Parameters
Implements |
# | ||||||
protected
|
fetchTimestamp(string $name): integer
Fetch a template's modification time from database
Fetch a template's modification time from database Parameters
Returnstimestamp (epoch) the template was modified Overrides |
# |
Methods inherited from Smarty_Resource_Custom |
---|
populate(), getContent(), getBasename() |
Properties | |||
---|---|---|---|
protected
|
PDO
|
$db
|
# |
protected
|
PDOStatement
|
$fetch
|
# |
protected
|
PDOStatement
|
$mtime
|
# |
Properties inherited from Smarty_Resource |
---|
$sysplugins, $uncompiled, $recompiled, $hasCompiledHandler |