diff options
Diffstat (limited to 'docs/programmers/api-functions')
32 files changed, 27 insertions, 554 deletions
diff --git a/docs/programmers/api-functions/add-extension.md b/docs/programmers/api-functions/add-extension.md new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/docs/programmers/api-functions/add-extension.md diff --git a/docs/programmers/api-functions/api-add-config-dir.md b/docs/programmers/api-functions/api-add-config-dir.md deleted file mode 100644 index c3a05228..00000000 --- a/docs/programmers/api-functions/api-add-config-dir.md +++ /dev/null @@ -1,49 +0,0 @@ -addConfigDir() - -add a directory to the list of directories where config files are stored - -Description -=========== - -Smarty - -addConfigDir - -string\|array - -config\_dir - -string - -key - - - <?php - - // add directory where config files are stored - $smarty->addConfigDir('./config_1'); - - // add directory where config files are stored and specify array-key - $smarty->addConfigDir('./config_1', 'one'); - - // add multiple directories where config files are stored and specify array-keys - $smarty->addTemplateDir(array( - 'two' => './config_2', - 'three' => './config_3', - )); - - // view the template dir chain - var_dump($smarty->getConfigDir()); - - // chaining of method calls - $smarty->setConfigDir('./config') - ->addConfigDir('./config_1', 'one') - ->addConfigDir('./config_2', 'two'); - - ?> - - - -See also [`getConfigDir()`](#api.get.config.dir), -[`setConfigDir()`](#api.set.config.dir) and -[`$config_dir`](#variable.config.dir). diff --git a/docs/programmers/api-functions/api-add-template-dir.md b/docs/programmers/api-functions/api-add-template-dir.md deleted file mode 100644 index e0d24564..00000000 --- a/docs/programmers/api-functions/api-add-template-dir.md +++ /dev/null @@ -1,49 +0,0 @@ -addTemplateDir() - -add a directory to the list of directories where templates are stored - -Description -=========== - -Smarty - -addTemplateDir - -string\|array - -template\_dir - -string - -key - - - <?php - - // add directory where templates are stored - $smarty->addTemplateDir('./templates_1'); - - // add directory where templates are stored and specify array-key - $smarty->addTemplateDir('./templates_1', 'one'); - - // add multiple directories where templates are stored and specify array-keys - $smarty->addTemplateDir(array( - 'two' => './templates_2', - 'three' => './templates_3', - )); - - // view the template dir chain - var_dump($smarty->getTemplateDir()); - - // chaining of method calls - $smarty->setTemplateDir('./templates') - ->addTemplateDir('./templates_1', 'one') - ->addTemplateDir('./templates_2', 'two'); - - ?> - - - -See also [`getTemplateDir()`](#api.get.template.dir), -[`setTemplateDir()`](#api.set.template.dir) and -[`$template_dir`](#variable.template.dir). diff --git a/docs/programmers/api-functions/api-append-by-ref.md b/docs/programmers/api-functions/api-append-by-ref.md deleted file mode 100644 index cd396d9c..00000000 --- a/docs/programmers/api-functions/api-append-by-ref.md +++ /dev/null @@ -1,46 +0,0 @@ -appendByRef() - -append values by reference - -Description -=========== - -void - -appendByRef - -string - -varname - -mixed - -var - -bool - -merge - -This is used to [`append()`](#api.append) values to the templates by -reference. - -> **Note** -> -> With the introduction of PHP5, `appendByRef()` is not necessary for -> most intents and purposes. `appendByRef()` is useful if you want a PHP -> array index value to be affected by its reassignment from a template. -> Assigned object properties behave this way by default. - -NOTE.PARAMETER.MERGE - - - <?php - // appending name/value pairs - $smarty->appendByRef('Name', $myname); - $smarty->appendByRef('Address', $address); - ?> - - - -See also [`append()`](#api.append), [`assign()`](#api.assign) and -[`getTemplateVars()`](#api.get.template.vars). diff --git a/docs/programmers/api-functions/api-append.md b/docs/programmers/api-functions/api-append.md index b9458641..d9acff84 100644 --- a/docs/programmers/api-functions/api-append.md +++ b/docs/programmers/api-functions/api-append.md @@ -56,6 +56,5 @@ NOTE.PARAMETER.MERGE -See also [`appendByRef()`](#api.append.by.ref), -[`assign()`](#api.assign) and +See also [`assign()`](#api.assign) and [`getTemplateVars()`](#api.get.template.vars) diff --git a/docs/programmers/api-functions/api-assign-by-ref.md b/docs/programmers/api-functions/api-assign-by-ref.md deleted file mode 100644 index 7c42b483..00000000 --- a/docs/programmers/api-functions/api-assign-by-ref.md +++ /dev/null @@ -1,42 +0,0 @@ -assignByRef() - -assign values by reference - -Description -=========== - -void - -assignByRef - -string - -varname - -mixed - -var - -This is used to [`assign()`](#api.assign) values to the templates by -reference. - -> **Note** -> -> With the introduction of PHP5, `assignByRef()` is not necessary for -> most intents and purposes. `assignByRef()` is useful if you want a PHP -> array index value to be affected by its reassignment from a template. -> Assigned object properties behave this way by default. - - - <?php - // passing name/value pairs - $smarty->assignByRef('Name', $myname); - $smarty->assignByRef('Address', $address); - ?> - - - -See also [`assign()`](#api.assign), -[`clearAllAssign()`](#api.clear.all.assign), [`append()`](#api.append), -[`{assign}`](#language.function.assign) and -[`getTemplateVars()`](#api.get.template.vars). diff --git a/docs/programmers/api-functions/api-assign.md b/docs/programmers/api-functions/api-assign.md index c3b9985d..31f6a150 100644 --- a/docs/programmers/api-functions/api-assign.md +++ b/docs/programmers/api-functions/api-assign.md @@ -78,7 +78,6 @@ To access more complex array assignments see [`{foreach}`](#language.function.foreach) and [`{section}`](#language.function.section) -See also [`assignByRef()`](#api.assign.by.ref), -[`getTemplateVars()`](#api.get.template.vars), +See also [`getTemplateVars()`](#api.get.template.vars), [`clearAssign()`](#api.clear.assign), [`append()`](#api.append) and [`{assign}`](#language.function.assign) diff --git a/docs/programmers/api-functions/api-compile-all-config.md b/docs/programmers/api-functions/api-compile-all-config.md index a102fc97..35497d9a 100644 --- a/docs/programmers/api-functions/api-compile-all-config.md +++ b/docs/programmers/api-functions/api-compile-all-config.md @@ -50,7 +50,7 @@ parameters: <?php - include('Smarty.class.php'); + use Smarty\Smarty; $smarty = new Smarty; // force compilation of all config files diff --git a/docs/programmers/api-functions/api-compile-all-templates.md b/docs/programmers/api-functions/api-compile-all-templates.md index 53a021da..2be22eef 100644 --- a/docs/programmers/api-functions/api-compile-all-templates.md +++ b/docs/programmers/api-functions/api-compile-all-templates.md @@ -60,7 +60,7 @@ parameters: <?php - include('Smarty.class.php'); + use Smarty\Smarty; $smarty = new Smarty; // force compilation of all template files diff --git a/docs/programmers/api-functions/api-create-data.md b/docs/programmers/api-functions/api-create-data.md index 7e083776..dc03ad94 100644 --- a/docs/programmers/api-functions/api-create-data.md +++ b/docs/programmers/api-functions/api-create-data.md @@ -30,7 +30,7 @@ be used to control which variables are seen by which templates. <?php - include('Smarty.class.php'); + use Smarty\Smarty; $smarty = new Smarty; // create data object with its private variable scope diff --git a/docs/programmers/api-functions/api-create-template.md b/docs/programmers/api-functions/api-create-template.md index 5129406d..097b7df9 100644 --- a/docs/programmers/api-functions/api-create-template.md +++ b/docs/programmers/api-functions/api-create-template.md @@ -80,7 +80,7 @@ following parameters: <?php - include('Smarty.class.php'); + use Smarty\Smarty; $smarty = new Smarty; // create template object with its private variable scope diff --git a/docs/programmers/api-functions/api-display.md b/docs/programmers/api-functions/api-display.md index 59726195..ced7513f 100644 --- a/docs/programmers/api-functions/api-display.md +++ b/docs/programmers/api-functions/api-display.md @@ -31,7 +31,9 @@ PARAMETER.COMPILEID <?php - include(SMARTY_DIR.'Smarty.class.php'); + + use Smarty\Smarty; + $smarty = new Smarty(); $smarty->setCaching(true); diff --git a/docs/programmers/api-functions/api-fetch.md b/docs/programmers/api-functions/api-fetch.md index 6da05bd0..491c28d4 100644 --- a/docs/programmers/api-functions/api-fetch.md +++ b/docs/programmers/api-functions/api-fetch.md @@ -30,7 +30,7 @@ PARAMETER.COMPILEID <?php - include('Smarty.class.php'); + use Smarty\Smarty; $smarty = new Smarty; $smarty->setCaching(true); diff --git a/docs/programmers/api-functions/api-get-cache-dir.md b/docs/programmers/api-functions/api-get-cache-dir.md deleted file mode 100644 index 9e55d8d0..00000000 --- a/docs/programmers/api-functions/api-get-cache-dir.md +++ /dev/null @@ -1,23 +0,0 @@ -getCacheDir() - -return the directory where the rendered template\'s output is stored - -Description -=========== - -string - -getCacheDir - - - <?php - - // get directory where compiled templates are stored - $cacheDir = $smarty->getCacheDir(); - - ?> - - - -See also [`setCacheDir()`](#api.set.cache.dir) and -[`$cache_dir`](#variable.cache.dir). diff --git a/docs/programmers/api-functions/api-get-compile-dir.md b/docs/programmers/api-functions/api-get-compile-dir.md deleted file mode 100644 index 3bfae730..00000000 --- a/docs/programmers/api-functions/api-get-compile-dir.md +++ /dev/null @@ -1,23 +0,0 @@ -getCompileDir() - -returns the directory where compiled templates are stored - -Description -=========== - -string - -getCompileDir - - - <?php - - // get directory where compiled templates are stored - $compileDir = $smarty->getCompileDir(); - - ?> - - - -See also [`setCompileDir()`](#api.set.compile.dir) and -[`$compile_dir`](#variable.compile.dir). diff --git a/docs/programmers/api-functions/api-get-tags.md b/docs/programmers/api-functions/api-get-tags.md deleted file mode 100644 index 7729b468..00000000 --- a/docs/programmers/api-functions/api-get-tags.md +++ /dev/null @@ -1,40 +0,0 @@ -getTags() - -return tags used by template - -Description -=========== - -string - -getTags - -object - -template - -This function returns an array of tagname/attribute pairs for all tags -used by the template. It uses the following parameters: - -- `template` is the template object. - -> **Note** -> -> This function is experimental. - - - <?php - include('Smarty.class.php'); - $smarty = new Smarty; - - // create template object - $tpl = $smarty->createTemplate('index.tpl'); - - // get tags - $tags = $smarty->getTags($tpl); - - print_r($tags); - - ?> - - diff --git a/docs/programmers/api-functions/api-get-template-dir.md b/docs/programmers/api-functions/api-get-template-dir.md deleted file mode 100644 index 42c75908..00000000 --- a/docs/programmers/api-functions/api-get-template-dir.md +++ /dev/null @@ -1,40 +0,0 @@ -getTemplateDir() - -return the directory where templates are stored - -Description -=========== - -string\|array - -getTemplateDir - -string - -key - - - <?php - - // set some template directories - $smarty->setTemplateDir(array( - 'one' => './templates', - 'two' => './templates_2', - 'three' => './templates_3', - )); - - // get all directories where templates are stored - $template_dir = $smarty->getTemplateDir(); - var_dump($template_dir); // array - - // get directory identified by key - $template_dir = $smarty->getTemplateDir('one'); - var_dump($template_dir); // string - - ?> - - - -See also [`setTemplateDir()`](#api.set.template.dir), -[`addTemplateDir()`](#api.add.template.dir) and -[`$template_dir`](#variable.template.dir). diff --git a/docs/programmers/api-functions/api-is-cached.md b/docs/programmers/api-functions/api-is-cached.md index 0c41bf04..d9d3057f 100644 --- a/docs/programmers/api-functions/api-is-cached.md +++ b/docs/programmers/api-functions/api-is-cached.md @@ -22,8 +22,8 @@ string compile\_id - This only works if [`$caching`](#variable.caching) is set to one of - `Smarty::CACHING_LIFETIME_CURRENT` or - `Smarty::CACHING_LIFETIME_SAVED` to enable caching. See the [caching + `\Smarty\Smarty::CACHING_LIFETIME_CURRENT` or + `\Smarty\Smarty::CACHING_LIFETIME_SAVED` to enable caching. See the [caching section](#caching) for more info. - You can also pass a `$cache_id` as an optional second parameter in diff --git a/docs/programmers/api-functions/api-load-filter.md b/docs/programmers/api-functions/api-load-filter.md index 19286ee3..e2738b0c 100644 --- a/docs/programmers/api-functions/api-load-filter.md +++ b/docs/programmers/api-functions/api-load-filter.md @@ -18,7 +18,7 @@ string name The first argument specifies the type of the filter to load and can be -one of the following: `pre`, `post` or `output`. The second argument +one of the following: `variable`, `pre`, `post` or `output`. The second argument specifies the `name` of the filter plugin. @@ -37,6 +37,5 @@ specifies the `name` of the filter plugin. -See also [`registerFilter()`](#api.register.filter), -[`$autoload_filters`](#variable.autoload.filters) and [advanced +See also [`registerFilter()`](#api.register.filter) and [advanced features](#advanced.features). diff --git a/docs/programmers/api-functions/api-mute-expected-errors.md b/docs/programmers/api-functions/api-mute-expected-errors.md index 626288ea..ac84a643 100644 --- a/docs/programmers/api-functions/api-mute-expected-errors.md +++ b/docs/programmers/api-functions/api-mute-expected-errors.md @@ -15,7 +15,7 @@ handler merely inspects `$errno` and `$errfile` to determine if the given error was produced deliberately and must be ignored, or should be passed on to the next error handler. -`Smarty::unmuteExpectedErrors()` removes the current error handler. +`\Smarty\Smarty::unmuteExpectedErrors()` removes the current error handler. Please note, that if you\'ve registered any custom error handlers after the muteExpectedErrors() call, the unmute will not remove Smarty\'s muting error handler, but the one registered last. diff --git a/docs/programmers/api-functions/api-register-cacheresource.md b/docs/programmers/api-functions/api-register-cacheresource.md index 60ae6030..62609149 100644 --- a/docs/programmers/api-functions/api-register-cacheresource.md +++ b/docs/programmers/api-functions/api-register-cacheresource.md @@ -31,7 +31,7 @@ how to create custom CacheResources. <?php - $smarty->registerCacheResource('mysql', new Smarty_CacheResource_Mysql()); + $smarty->registerCacheResource('mysql', new My_CacheResource_Mysql()); ?> diff --git a/docs/programmers/api-functions/api-register-class.md b/docs/programmers/api-functions/api-register-class.md index ee339cad..d0156d51 100644 --- a/docs/programmers/api-functions/api-register-class.md +++ b/docs/programmers/api-functions/api-register-class.md @@ -24,6 +24,7 @@ otherwise. If security is enabled, classes registered with <?php + use Smarty\Smarty; class Bar { $property = "hello world"; @@ -44,12 +45,14 @@ otherwise. If security is enabled, classes registered with <?php + use Smarty\Smarty; + namespace my\php\application { class Bar { $property = "hello world"; } } - + $smarty = new Smarty(); $smarty->registerClass("Foo", "\my\php\application\Bar"); diff --git a/docs/programmers/api-functions/api-register-default-plugin-handler.md b/docs/programmers/api-functions/api-register-default-plugin-handler.md index 03547df7..61ac4761 100644 --- a/docs/programmers/api-functions/api-register-default-plugin-handler.md +++ b/docs/programmers/api-functions/api-register-default-plugin-handler.md @@ -25,7 +25,7 @@ plugin types. <?php - + use Smarty\Smarty; $smarty = new Smarty(); $smarty->registerDefaultPluginHandler('my_plugin_handler'); @@ -37,7 +37,7 @@ plugin types. * @param string $name name of the undefined tag * @param string $type tag type (e.g. Smarty::PLUGIN_FUNCTION, Smarty::PLUGIN_BLOCK, Smarty::PLUGIN_COMPILER, Smarty::PLUGIN_MODIFIER, Smarty::PLUGIN_MODIFIERCOMPILER) - * @param Smarty_Internal_Template $template template object + * @param \Smarty\Template\ $template template object * @param string &$callback returned function name * @param string &$script optional returned script filepath if function is external * @param bool &$cacheable true by default, set to false if plugin is not cachable (Smarty >= 3.1.8) diff --git a/docs/programmers/api-functions/api-register-filter.md b/docs/programmers/api-functions/api-register-filter.md index fd91d266..4a2aa4b0 100644 --- a/docs/programmers/api-functions/api-register-filter.md +++ b/docs/programmers/api-functions/api-register-filter.md @@ -38,8 +38,7 @@ filters](#advanced.features.outputfilters) for more information on how to set up an output filter function. See also [`unregisterFilter()`](#api.unregister.filter), -[`loadFilter()`](#api.load.filter), -[`$autoload_filters`](#variable.autoload.filters), [template pre +[`loadFilter()`](#api.load.filter), [template pre filters](#advanced.features.prefilters) [template post filters](#advanced.features.postfilters) [template output filters](#advanced.features.outputfilters) section. diff --git a/docs/programmers/api-functions/api-register-plugin.md b/docs/programmers/api-functions/api-register-plugin.md index 6eb43381..51342b8e 100644 --- a/docs/programmers/api-functions/api-register-plugin.md +++ b/docs/programmers/api-functions/api-register-plugin.md @@ -32,9 +32,9 @@ cache\_attrs This method registers functions or methods defined in your script as plugin. It uses the following parameters: -- `cacheable` and `cache_attrs` can be omitted in most cases. See +- `cacheable` can be omitted in most cases. See [controlling cacheability of plugins output](#caching.cacheable) on - how to use them properly. + how to use this properly. <!-- --> diff --git a/docs/programmers/api-functions/api-register-resource.md b/docs/programmers/api-functions/api-register-resource.md index ca400546..774452bf 100644 --- a/docs/programmers/api-functions/api-register-resource.md +++ b/docs/programmers/api-functions/api-register-resource.md @@ -37,7 +37,7 @@ information on how to setup a function for fetching templates. <?php - $smarty->registerResource('mysql', new Smarty_Resource_Mysql()); + $smarty->registerResource('mysql', new My_Resource_Mysql()); ?> diff --git a/docs/programmers/api-functions/api-set-cache-dir.md b/docs/programmers/api-functions/api-set-cache-dir.md deleted file mode 100644 index 7f7c4b60..00000000 --- a/docs/programmers/api-functions/api-set-cache-dir.md +++ /dev/null @@ -1,32 +0,0 @@ -setCacheDir() - -set the directory where the rendered template\'s output is stored - -Description -=========== - -Smarty - -setCacheDir - -string - -cache\_dir - - - <?php - - // set directory where rendered template's output is stored - $smarty->setCacheDir('./cache'); - - // chaining of method calls - $smarty->setTemplateDir('./templates') - ->setCompileDir('./templates_c') - ->setCacheDir('./cache'); - - ?> - - - -See also [`getCacheDir()`](#api.get.cache.dir) and -[`$cache_dir`](#variable.cache.dir). diff --git a/docs/programmers/api-functions/api-set-compile-dir.md b/docs/programmers/api-functions/api-set-compile-dir.md deleted file mode 100644 index bfeb55a5..00000000 --- a/docs/programmers/api-functions/api-set-compile-dir.md +++ /dev/null @@ -1,32 +0,0 @@ -setCompileDir() - -set the directory where compiled templates are stored - -Description -=========== - -Smarty - -setCompileDir - -string - -compile\_dir - - - <?php - - // set directory where compiled templates are stored - $smarty->setCompileDir('./templates_c'); - - // chaining of method calls - $smarty->setTemplateDir('./templates') - ->setCompileDir('./templates_c') - ->setCacheDir('./cache'); - - ?> - - - -See also [`getCompileDir()`](#api.get.compile.dir) and -[`$compile_dir`](#variable.compile.dir). diff --git a/docs/programmers/api-functions/api-set-config-dir.md b/docs/programmers/api-functions/api-set-config-dir.md deleted file mode 100644 index 97a6ae97..00000000 --- a/docs/programmers/api-functions/api-set-config-dir.md +++ /dev/null @@ -1,47 +0,0 @@ -setConfigDir() - -set the directories where config files are stored - -Description -=========== - -Smarty - -setConfigDir - -string\|array - -config\_dir - - - <?php - - // set a single directory where the config files are stored - $smarty->setConfigDir('./config'); - - // view the config dir chain - var_dump($smarty->getConfigDir()); - - // set multiple directorÃes where config files are stored - $smarty->setConfigDir(array( - 'one' => './config', - 'two' => './config_2', - 'three' => './config_3', - )); - - // view the config dir chain - var_dump($smarty->getConfigDir()); - - // chaining of method calls - $smarty->setTemplateDir('./templates') - ->setConfigDir('./config') - ->setCompileDir('./templates_c') - ->setCacheDir('./cache'); - - ?> - - - -See also [`getConfigDir()`](#api.get.config.dir), -[`addConfigDir()`](#api.add.config.dir) and -[`$config_dir`](#variable.config.dir). diff --git a/docs/programmers/api-functions/api-set-template-dir.md b/docs/programmers/api-functions/api-set-template-dir.md deleted file mode 100644 index 2de23309..00000000 --- a/docs/programmers/api-functions/api-set-template-dir.md +++ /dev/null @@ -1,46 +0,0 @@ -setTemplateDir() - -set the directories where templates are stored - -Description -=========== - -Smarty - -setTemplateDir - -string\|array - -template\_dir - - - <?php - - // set a single directory where the templates are stored - $smarty->setTemplateDir('./cache'); - - // view the template dir chain - var_dump($smarty->getTemplateDir()); - - // set multiple directorÃes where templates are stored - $smarty->setTemplateDir(array( - 'one' => './templates', - 'two' => './templates_2', - 'three' => './templates_3', - )); - - // view the template dir chain - var_dump($smarty->getTemplateDir()); - - // chaining of method calls - $smarty->setTemplateDir('./templates') - ->setCompileDir('./templates_c') - ->setCacheDir('./cache'); - - ?> - - - -See also [`getTemplateDir()`](#api.get.template.dir), -[`addTemplateDir()`](#api.add.template.dir) and -[`$template_dir`](#variable.template.dir). diff --git a/docs/programmers/api-functions/api-template-exists.md b/docs/programmers/api-functions/api-template-exists.md deleted file mode 100644 index 07f61b12..00000000 --- a/docs/programmers/api-functions/api-template-exists.md +++ /dev/null @@ -1,59 +0,0 @@ -templateExists() - -checks whether the specified template exists - -Description -=========== - -bool - -templateExists - -string - -template - -It can accept either a path to the template on the filesystem or a -resource string specifying the template. - -This example uses `$_GET['page']` to -[`{include}`](#language.function.include) a content template. If the -template does not exist then an error page is displayed instead. First -the `page_container.tpl` - - - <html> - <head><title>{$title}</title></head> - <body> - {include file='page_top.tpl'} - - {* include middle content page *} - {include file=$content_template} - - {include file='page_footer.tpl'} - </body> - - - -And the php script - - - <?php - - // set the filename eg index.inc.tpl - $mid_template = $_GET['page'].'.inc.tpl'; - - if( !$smarty->templateExists($mid_template) ){ - $mid_template = 'page_not_found.tpl'; - } - $smarty->assign('content_template', $mid_template); - - $smarty->display('page_container.tpl'); - - ?> - - - -See also [`display()`](#api.display), [`fetch()`](#api.fetch), -[`{include}`](#language.function.include) and -[`{insert}`](#language.function.insert) diff --git a/docs/programmers/api-functions/api-test-install.md b/docs/programmers/api-functions/api-test-install.md index 918bd220..bba64a19 100644 --- a/docs/programmers/api-functions/api-test-install.md +++ b/docs/programmers/api-functions/api-test-install.md @@ -14,7 +14,7 @@ installation can be accessed. It does output a corresponding protocol. <?php - require_once('Smarty.class.php'); + use Smarty\Smarty; $smarty = new Smarty(); $smarty->testInstall(); ?> |
