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. Note that this MySQL implementation fetches the source and timestamps in a single database query, instead of two separate 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}');
Methods | ||||||||
---|---|---|---|---|---|---|---|---|
public
|
__construct()
Smarty_Resource_Mysqls 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 |
# |
Methods inherited from Smarty_Resource_Custom |
---|
fetchTimestamp(), populate(), getContent(), getBasename() |
Properties | |||
---|---|---|---|
protected
|
PDO
|
$db
|
# |
protected
|
PDOStatement
|
$fetch
|
# |
Properties inherited from Smarty_Resource |
---|
$sysplugins, $uncompiled, $recompiled, $hasCompiledHandler |