Smarty Internal Plugin Resource PHP

Implements the file system as resource for PHP templates

package Smarty
subpackage TemplateResources
author Uwe Tews
author Rodney Rehm

 Methods

Create a new PHP Resource

__construct() 

initialize Config Source Object for given resource

config(\Smarty_Internal_Config $_config) : \Smarty_Config_Source
InheritedStatic
inherited_from \Smarty_Resource::config()
inherited_from \Smarty_Resource_Uncompiled::config()

Parameters

$_config

\Smarty_Internal_Config

config object

Returns

\Smarty_Config_SourceSource Object

Load template's source from file into current template object

getContent(\Smarty_Template_Source $source) : string

Parameters

$source

\Smarty_Template_Source

source object

Exceptions

\SmartyException if source cannot be loaded

Returns

stringtemplate source

modify template_resource according to resource handlers specifications

getUniqueTemplateName(string $smarty, string $template_resource) : string
InheritedStatic
inherited_from \Smarty_Resource::getUniqueTemplateName()
inherited_from \Smarty_Resource_Uncompiled::getUniqueTemplateName()

Parameters

$smarty

string

Smarty instance

$template_resource

string

template_resource to extracate resource handler and name of

Returns

stringunique resource name

Load Resource Handler

load(\Smarty $smarty, string $type) : \Smarty_Resource
InheritedStatic
inherited_from \Smarty_Resource::load()
inherited_from \Smarty_Resource_Uncompiled::load()

Parameters

$smarty

\Smarty

smarty object

$type

string

name of the resource

Returns

\Smarty_ResourceResource Handler

populate Source Object with meta data from Resource

populate(\Smarty_Template_Source $source, \Smarty_Internal_Template $_template) : void

Parameters

$source

\Smarty_Template_Source

source object

$_template

\Smarty_Internal_Template

template object

populate compiled object with compiled filepath

populateCompiledFilepath(\Smarty_Template_Compiled $compiled, \Smarty_Internal_Template $_template) 
Inherited
inherited_from \Smarty_Resource_Uncompiled::populateCompiledFilepath()

Parameters

$compiled

\Smarty_Template_Compiled

compiled object

$_template

\Smarty_Internal_Template

template object (is ignored)

populate Source Object with timestamp and exists from Resource

populateTimestamp(\Smarty_Template_Source $source) : void

Parameters

$source

\Smarty_Template_Source

source object

Render and output the template (without using the compiler)

renderUncompiled(\Smarty_Template_Source $source, \Smarty_Internal_Template $_template) : void

Parameters

$source

\Smarty_Template_Source

source object

$_template

\Smarty_Internal_Template

template object

Exceptions

\SmartyException if template cannot be loaded or allow_php_templates is disabled

initialize Source Object for given resource

source(\Smarty_Internal_Template $_template, \Smarty $smarty, string $template_resource) : \Smarty_Template_Source
InheritedStatic

Either [$_template] or [$smarty, $template_resource] must be specified

inherited_from \Smarty_Resource::source()
inherited_from \Smarty_Resource_Uncompiled::source()

Parameters

$_template

\Smarty_Internal_Template

template object

$smarty

\Smarty

smarty object

$template_resource

string

resource identifier

Returns

build template filepath by traversing the template_dir array

buildFilepath(\Smarty_Template_Source $source, \Smarty_Internal_Template $_template) : string
Inherited
inherited_from \Smarty_Resource::buildFilepath()
inherited_from \Smarty_Resource_Uncompiled::buildFilepath()

Parameters

$source

\Smarty_Template_Source

source object

$_template

\Smarty_Internal_Template

template object

Exceptions

\SmartyException if default template handler is registered but not callable

Returns

stringfully qualified filepath

modify resource_name according to resource handlers specifications

buildUniqueResourceName(\Smarty $smarty, string $resource_name) : string
Inherited
inherited_from \Smarty_Resource::buildUniqueResourceName()
inherited_from \Smarty_Resource_Uncompiled::buildUniqueResourceName()

Parameters

$smarty

\Smarty

Smarty instance

$resource_name

string

resource_name to make unique

Returns

stringunique resource name

test is file exists and save timestamp

fileExists(\Smarty_Template_Source $source, string $file) : bool
Inherited
inherited_from \Smarty_Resource::fileExists()
inherited_from \Smarty_Resource_Uncompiled::fileExists()

Parameters

$source

\Smarty_Template_Source

source object

$file

string

file name

Returns

booltrue if file exists

Determine basename for compiled filename

getBasename(\Smarty_Template_Source $source) : string
Inherited
inherited_from \Smarty_Resource::getBasename()
inherited_from \Smarty_Resource_Uncompiled::getBasename()

Parameters

$source

\Smarty_Template_Source

source object

Returns

stringresource's basename

Normalize Paths "foo/.

normalizePath(string $_path, boolean $ds) : string
Inherited

./bar" to "bar"

inherited_from \Smarty_Resource::normalizePath()
inherited_from \Smarty_Resource_Uncompiled::normalizePath()

Parameters

$_path

string

path to normalize

$ds

boolean

respect windows directory separator

Returns

stringnormalized path

extract resource_type and resource_name from template_resource and config_resource

parseResourceName(string $resource_name, string $default_resource, string $name, string $type) : void
InheritedStatic
note "C:/foo.tpl" was forced to file resource up till Smarty 3.1.3 (including).
inherited_from \Smarty_Resource::parseResourceName()
inherited_from \Smarty_Resource_Uncompiled::parseResourceName()

Parameters

$resource_name

string

template_resource or config_resource to parse

$default_resource

string

the default resource_type defined in $smarty

$name

string

&$name the parsed resource name

$type

string

&$type the parsed resource type

 Properties

 

$compileds : array
Inherited
inherited_from \Smarty_Resource::$$compileds
inherited_from \Smarty_Resource_Uncompiled::$$compileds
 

$compiler_class : string
Inherited
inherited_from \Smarty_Resource::$$compiler_class
inherited_from \Smarty_Resource_Uncompiled::$$compiler_class
 

$resources : array
Inherited
inherited_from \Smarty_Resource::$$resources
inherited_from \Smarty_Resource_Uncompiled::$$resources
 

$sources : array
Inherited
inherited_from \Smarty_Resource::$$sources
inherited_from \Smarty_Resource_Uncompiled::$$sources
 

$template_lexer_class : string
Inherited
inherited_from \Smarty_Resource::$$template_lexer_class
inherited_from \Smarty_Resource_Uncompiled::$$template_lexer_class
 

$template_parser_class : string
Inherited
inherited_from \Smarty_Resource::$$template_parser_class
inherited_from \Smarty_Resource_Uncompiled::$$template_parser_class
 

$short_open_tag : string
 

$sysplugins : array
Inherited
inherited_from \Smarty_Resource::$$sysplugins
inherited_from \Smarty_Resource_Uncompiled::$$sysplugins