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
Strict standards: Only variables should be passed by reference in C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty_Compiler.class.php on line 712 Call Stack: 0.0006 229032 1. {main}() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpdoc:0 0.0027 240216 2. include('C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\phpdoc.inc') C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpdoc:59 0.1463 8650352 3. phpDocumentor_setup->createDocs() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\phpdoc.inc:65 13.2331 130016152 4. phpDocumentor_IntermediateParser->Output() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Setup.inc.php:761 13.9644 131381624 5. phpDocumentor_IntermediateParser->Convert() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\IntermediateParser.inc:1865 13.9644 131381720 6. Converter->walk() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\IntermediateParser.inc:1652 17.1495 134756784 7. HTMLframesConverter->endClass() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Converter.inc:1936 17.1499 134757928 8. Smarty->fetch() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Converters\HTML\frames\HTMLframesConverter.inc:347 17.1894 135249960 9. include('C:\wamp\www\smarty3.1.0\development\Smarty3Doc\Resource-examples\26d3399f63abd43a7d72f8c21440dcb0\%%165^%%1653142046^class.tpl.php') C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1298 17.2106 135409504 10. Smarty->_smarty_include() C:\wamp\www\smarty3.1.0\development\Smarty3Doc\Resource-examples\26d3399f63abd43a7d72f8c21440dcb0\%%165^%%1653142046^class.tpl.php:585 17.2108 135414016 11. Smarty->_compile_resource() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1935 17.2118 135420680 12. Smarty->_compile_source() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1458 17.2122 135455256 13. Smarty_Compiler->_compile_file() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1523 17.2134 135504656 14. Smarty_Compiler->_compile_tag() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty_Compiler.class.php:316 17.2143 135505680 15. Smarty_Compiler->_compile_custom_tag() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty_Compiler.class.php:537 Strict standards: Only variables should be passed by reference in C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty_Compiler.class.php on line 712 Call Stack: 0.0006 229032 1. {main}() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpdoc:0 0.0027 240216 2. include('C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\phpdoc.inc') C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpdoc:59 0.1463 8650352 3. phpDocumentor_setup->createDocs() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\phpdoc.inc:65 13.2331 130016152 4. phpDocumentor_IntermediateParser->Output() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Setup.inc.php:761 13.9644 131381624 5. phpDocumentor_IntermediateParser->Convert() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\IntermediateParser.inc:1865 13.9644 131381720 6. Converter->walk() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\IntermediateParser.inc:1652 17.1495 134756784 7. HTMLframesConverter->endClass() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Converter.inc:1936 17.1499 134757928 8. Smarty->fetch() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Converters\HTML\frames\HTMLframesConverter.inc:347 17.1894 135249960 9. include('C:\wamp\www\smarty3.1.0\development\Smarty3Doc\Resource-examples\26d3399f63abd43a7d72f8c21440dcb0\%%165^%%1653142046^class.tpl.php') C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1298 17.2106 135409504 10. Smarty->_smarty_include() C:\wamp\www\smarty3.1.0\development\Smarty3Doc\Resource-examples\26d3399f63abd43a7d72f8c21440dcb0\%%165^%%1653142046^class.tpl.php:585 17.2108 135414016 11. Smarty->_compile_resource() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1935 17.2118 135420680 12. Smarty->_compile_source() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1458 17.2122 135455256 13. Smarty_Compiler->_compile_file() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1523 17.2200 135518416 14. Smarty_Compiler->_compile_tag() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty_Compiler.class.php:316 17.2207 135519480 15. Smarty_Compiler->_compile_custom_tag() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty_Compiler.class.php:537
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
Strict standards: Only variables should be passed by reference in C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty_Compiler.class.php on line 712 Call Stack: 0.0006 229032 1. {main}() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpdoc:0 0.0027 240216 2. include('C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\phpdoc.inc') C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpdoc:59 0.1463 8650352 3. phpDocumentor_setup->createDocs() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\phpdoc.inc:65 13.2331 130016152 4. phpDocumentor_IntermediateParser->Output() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Setup.inc.php:761 13.9644 131381624 5. phpDocumentor_IntermediateParser->Convert() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\IntermediateParser.inc:1865 13.9644 131381720 6. Converter->walk() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\IntermediateParser.inc:1652 17.1495 134756784 7. HTMLframesConverter->endClass() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Converter.inc:1936 17.1499 134757928 8. Smarty->fetch() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Converters\HTML\frames\HTMLframesConverter.inc:347 17.1894 135249960 9. include('C:\wamp\www\smarty3.1.0\development\Smarty3Doc\Resource-examples\26d3399f63abd43a7d72f8c21440dcb0\%%165^%%1653142046^class.tpl.php') C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1298 17.2390 135417240 10. Smarty->_smarty_include() C:\wamp\www\smarty3.1.0\development\Smarty3Doc\Resource-examples\26d3399f63abd43a7d72f8c21440dcb0\%%165^%%1653142046^class.tpl.php:686 17.2392 135421608 11. Smarty->_compile_resource() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1935 17.2395 135435384 12. Smarty->_compile_source() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1458 17.2398 135473592 13. Smarty_Compiler->_compile_file() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1523 17.2413 135572984 14. Smarty_Compiler->_compile_tag() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty_Compiler.class.php:316 17.2420 135574056 15. Smarty_Compiler->_compile_custom_tag() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty_Compiler.class.php:537 Strict standards: Only variables should be passed by reference in C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty_Compiler.class.php on line 712 Call Stack: 0.0006 229032 1. {main}() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpdoc:0 0.0027 240216 2. include('C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\phpdoc.inc') C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpdoc:59 0.1463 8650352 3. phpDocumentor_setup->createDocs() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\phpdoc.inc:65 13.2331 130016152 4. phpDocumentor_IntermediateParser->Output() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Setup.inc.php:761 13.9644 131381624 5. phpDocumentor_IntermediateParser->Convert() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\IntermediateParser.inc:1865 13.9644 131381720 6. Converter->walk() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\IntermediateParser.inc:1652 17.1495 134756784 7. HTMLframesConverter->endClass() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Converter.inc:1936 17.1499 134757928 8. Smarty->fetch() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Converters\HTML\frames\HTMLframesConverter.inc:347 17.1894 135249960 9. include('C:\wamp\www\smarty3.1.0\development\Smarty3Doc\Resource-examples\26d3399f63abd43a7d72f8c21440dcb0\%%165^%%1653142046^class.tpl.php') C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1298 17.2390 135417240 10. Smarty->_smarty_include() C:\wamp\www\smarty3.1.0\development\Smarty3Doc\Resource-examples\26d3399f63abd43a7d72f8c21440dcb0\%%165^%%1653142046^class.tpl.php:686 17.2392 135421608 11. Smarty->_compile_resource() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1935 17.2395 135435384 12. Smarty->_compile_source() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1458 17.2398 135473592 13. Smarty_Compiler->_compile_file() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty.class.php:1523 17.2505 135615064 14. Smarty_Compiler->_compile_tag() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty_Compiler.class.php:316 17.2513 135616120 15. Smarty_Compiler->_compile_custom_tag() C:\wamp\www\phpdocumentator\PhpDocumentor-1.4.3\phpDocumentor\Smarty-2.6.0\libs\Smarty_Compiler.class.php:537
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::buildUniqueResourceName()
Smarty_Resource::config()
Smarty_Resource::fileExists()
Smarty_Resource::getBasename()
Smarty_Resource::getContent()
Smarty_Resource::getUniqueTemplateName()
Smarty_Resource::load()
Smarty_Resource::normalizePath()
Smarty_Resource::parseResourceName()
Smarty_Resource::populate()
Smarty_Resource::populateCompiledFilepath()
Smarty_Resource::populateTimestamp()
Smarty_Resource::source()

Documentation generated on Mon, 17 Jun 2013 21:06:42 +0000 by phpDocumentor 1.4.3