$uncompiled
$uncompiled : boolean
Source is bypassing compiler
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}');
populate(\Smarty_Template_Source $source, \Smarty_Internal_Template $_template = null)
populate Source Object with meta data from Resource
\Smarty_Template_Source | $source | source object |
\Smarty_Internal_Template | $_template | template object |
getContent(\Smarty_Template_Source $source) : string
Load template's source into current template object
\Smarty_Template_Source | $source | source object |
if source cannot be loaded
template source
getBasename(\Smarty_Template_Source $source) : string
Determine basename for compiled filename
\Smarty_Template_Source | $source | source object |
resource's basename
populateTimestamp(\Smarty_Template_Source $source)
populate Source Object with timestamp and exists from Resource
\Smarty_Template_Source | $source | source object |
buildUniqueResourceName(\Smarty $smarty, string $resource_name, boolean $isConfig = false) : string
modify resource_name according to resource handlers specifications
\Smarty | $smarty | Smarty instance |
string | $resource_name | resource_name to make unique |
boolean | $isConfig | flag for config resource |
unique resource name
load(\Smarty $smarty, string $type) : \Smarty_Resource
Load Resource Handler
\Smarty | $smarty | smarty object |
string | $type | name of the resource |
Resource Handler
parseResourceName(string $resource_name, string $default_resource) : array
extract resource_type and resource_name from template_resource and config_resource
string | $resource_name | template_resource or config_resource to parse |
string | $default_resource | the default resource_type defined in $smarty |
with parsed resource name and type
getUniqueTemplateName(\Smarty_Internal_Template|\Smarty $obj, string $template_resource) : string
modify template_resource according to resource handlers specifications
\Smarty_Internal_Template|\Smarty | $obj | Smarty instance |
string | $template_resource | template_resource to extract resource handler and name of |
unique resource name
source(\Smarty_Internal_Template $_template = null, \Smarty $smarty = null, string $template_resource = null) : \Smarty_Template_Source
initialize Source Object for given resource wrapper for backward compatibility to versions < 3.1.22 Either [$_template] or [$smarty, $template_resource] must be specified
\Smarty_Internal_Template | $_template | template object |
\Smarty | $smarty | smarty object |
string | $template_resource | resource identifier |
Source Object
fetchTimestamp(string $name) : integer
Fetch a template's modification time from database
Only implement it if modification times can be accessed faster than loading the complete template source.}}
string | $name | template name |
timestamp (epoch) the template was modified