diff options
Diffstat (limited to 'docs/programmers/api-variables')
15 files changed, 16 insertions, 195 deletions
diff --git a/docs/programmers/api-variables/variable-allow-php-templates.md b/docs/programmers/api-variables/variable-allow-php-templates.md deleted file mode 100644 index e15520e2..00000000 --- a/docs/programmers/api-variables/variable-allow-php-templates.md +++ /dev/null @@ -1,18 +0,0 @@ -\$allow\_php\_templates {#variable.allow.php.templates} -======================= - -By default the PHP template file resource is disabled. Setting -`$allow_php_templates` to TRUE will enable PHP template files. - -::: {.informalexample} - - <?php - $smarty->allow_php_templates = true; - ?> - - -::: - -> **Note** -> -> The PHP template file resource is an undocumented deprecated feature. diff --git a/docs/programmers/api-variables/variable-autoload-filters.md b/docs/programmers/api-variables/variable-autoload-filters.md deleted file mode 100644 index 8a300b06..00000000 --- a/docs/programmers/api-variables/variable-autoload-filters.md +++ /dev/null @@ -1,21 +0,0 @@ -\$autoload\_filters {#variable.autoload.filters} -=================== - -If there are some filters that you wish to load on every template -invocation, you can specify them using this variable and Smarty will -automatically load them for you. The variable is an associative array -where keys are filter types and values are arrays of the filter names. -For example: - -::: {.informalexample} - - <?php - $smarty->autoload_filters = array('pre' => array('trim', 'stamp'), - 'output' => array('convert')); - ?> - - -::: - -See also [`registerFilter()`](#api.register.filter) and -[`loadFilter()`](#api.load.filter) diff --git a/docs/programmers/api-variables/variable-cache-lifetime.md b/docs/programmers/api-variables/variable-cache-lifetime.md index c9624b55..481fbee8 100644 --- a/docs/programmers/api-variables/variable-cache-lifetime.md +++ b/docs/programmers/api-variables/variable-cache-lifetime.md @@ -5,8 +5,8 @@ This is the length of time in seconds that a template cache is valid. Once this time has expired, the cache will be regenerated. - `$caching` must be turned on (either - Smarty::CACHING\_LIFETIME\_CURRENT or - Smarty::CACHING\_LIFETIME\_SAVED) for `$cache_lifetime` to have any + \Smarty\Smarty::CACHING\_LIFETIME\_CURRENT or + \Smarty\Smarty::CACHING\_LIFETIME\_SAVED) for `$cache_lifetime` to have any purpose. - A `$cache_lifetime` value of -1 will force the cache to never @@ -14,11 +14,11 @@ Once this time has expired, the cache will be regenerated. - A value of 0 will cause the cache to always regenerate (good for testing only, to disable caching a more efficient method is to set - [`$caching`](#variable.caching) = Smarty::CACHING\_OFF). + [`$caching`](#variable.caching) = \Smarty\Smarty::CACHING\_OFF). - If you want to give certain templates their own cache lifetime, you could do this by setting [`$caching`](#variable.caching) = - Smarty::CACHING\_LIFETIME\_SAVED, then set `$cache_lifetime` to a + \Smarty\Smarty::CACHING\_LIFETIME\_SAVED, then set `$cache_lifetime` to a unique value just before calling [`display()`](#api.display) or [`fetch()`](#api.fetch). diff --git a/docs/programmers/api-variables/variable-cache-modified-check.md b/docs/programmers/api-variables/variable-cache-modified-check.md index 05e00bb9..815be255 100644 --- a/docs/programmers/api-variables/variable-cache-modified-check.md +++ b/docs/programmers/api-variables/variable-cache-modified-check.md @@ -4,8 +4,7 @@ If set to TRUE, Smarty will respect the If-Modified-Since header sent from the client. If the cached file timestamp has not changed since the last visit, then a `'304: Not Modified'` header will be sent instead of -the content. This works only on cached content without -[`{insert}`](#language.function.insert) tags. +the content. See also [`$caching`](#variable.caching), [`$cache_lifetime`](#variable.cache.lifetime), and the [caching diff --git a/docs/programmers/api-variables/variable-caching.md b/docs/programmers/api-variables/variable-caching.md index 9377e3b6..7304e41d 100644 --- a/docs/programmers/api-variables/variable-caching.md +++ b/docs/programmers/api-variables/variable-caching.md @@ -3,21 +3,21 @@ This tells Smarty whether or not to cache the output of the templates to the [`$cache_dir`](#variable.cache.dir). By default this is set to the -constant Smarty::CACHING\_OFF. If your templates consistently generate +constant \Smarty\Smarty::CACHING\_OFF. If your templates consistently generate the same content, it is advisable to turn on `$caching`, as this may result in significant performance gains. You can also have [multiple](#caching.multiple.caches) caches for the same template. -- A constant value of Smarty::CACHING\_LIFETIME\_CURRENT or - Smarty::CACHING\_LIFETIME\_SAVED enables caching. +- A constant value of \Smarty\Smarty::CACHING\_LIFETIME\_CURRENT or + \Smarty\Smarty ::CACHING\_LIFETIME\_SAVED enables caching. -- A value of Smarty::CACHING\_LIFETIME\_CURRENT tells Smarty to use +- A value of \Smarty\Smarty::CACHING\_LIFETIME\_CURRENT tells Smarty to use the current [`$cache_lifetime`](#variable.cache.lifetime) variable to determine if the cache has expired. -- A value of Smarty::CACHING\_LIFETIME\_SAVED tells Smarty to use the +- A value of \Smarty\Smarty::CACHING\_LIFETIME\_SAVED tells Smarty to use the [`$cache_lifetime`](#variable.cache.lifetime) value at the time the cache was generated. This way you can set the [`$cache_lifetime`](#variable.cache.lifetime) just before diff --git a/docs/programmers/api-variables/variable-compile-check.md b/docs/programmers/api-variables/variable-compile-check.md deleted file mode 100644 index 075e7f17..00000000 --- a/docs/programmers/api-variables/variable-compile-check.md +++ /dev/null @@ -1,30 +0,0 @@ -\$compile\_check {#variable.compile.check} -================ - -Upon each invocation of the PHP application, Smarty tests to see if the -current template has changed (different timestamp) since the last time -it was compiled. If it has changed, it recompiles that template. If the -template has yet not been compiled at all, it will compile regardless of -this setting. By default this variable is set to TRUE. - -Once an application is put into production (ie the templates won\'t be -changing), the compile check step is no longer needed. Be sure to set -`$compile_check` to FALSE for maximum performance. Note that if you -change this to FALSE and a template file is changed, you will \*not\* -see the change since the template will not get recompiled. - -Note that up to Smarty 4.x, Smarty will check for the existence of -the source template even if `$compile_check` is disabled. - -If [`$caching`](#variable.caching) is enabled and `$compile_check` is -enabled, then the cache files will get regenerated if an involved -template file or config file was updated. - -As of Smarty 3.1 `$compile_check` can be set to the value -`Smarty::COMPILECHECK_CACHEMISS`. This enables Smarty to revalidate the -compiled template, once a cache file is regenerated. So if there was a -cached template, but it\'s expired, Smarty will run a single -compile\_check before regenerating the cache. - -See [`$force_compile`](#variable.force.compile) and -[`clearCompiledTemplate()`](#api.clear.compiled.tpl). diff --git a/docs/programmers/api-variables/variable-debug-template.md b/docs/programmers/api-variables/variable-debug-template.md index faec0e17..11a80529 100644 --- a/docs/programmers/api-variables/variable-debug-template.md +++ b/docs/programmers/api-variables/variable-debug-template.md @@ -2,8 +2,7 @@ ============ This is the name of the template file used for the debugging console. By -default, it is named `debug.tpl` and is located in the -[`SMARTY_DIR`](#constant.smarty.dir). +default, it is named `debug.tpl` and is located in `src/debug.tpl`. See also [`$debugging`](#variable.debugging) and the [debugging console](#chapter.debugging.console) section. diff --git a/docs/programmers/api-variables/variable-default-config-handler-func.md b/docs/programmers/api-variables/variable-default-config-handler-func.md index 0d6ec5e0..50eb65bb 100644 --- a/docs/programmers/api-variables/variable-default-config-handler-func.md +++ b/docs/programmers/api-variables/variable-default-config-handler-func.md @@ -8,11 +8,11 @@ resource. > > The default handler is currently only invoked for file resources. It > is not triggered when the resource itself cannot be found, in which -> case a SmartyException is thrown. +> case a \Smarty\Exception is thrown. <?php - + use Smarty\Smarty; $smarty = new Smarty(); $smarty->default_config_handler_func = 'my_default_config_handler_func'; diff --git a/docs/programmers/api-variables/variable-default-template-handler-func.md b/docs/programmers/api-variables/variable-default-template-handler-func.md index d8fcbb1a..96c8190d 100644 --- a/docs/programmers/api-variables/variable-default-template-handler-func.md +++ b/docs/programmers/api-variables/variable-default-template-handler-func.md @@ -8,11 +8,11 @@ resource. > > The default handler is currently only invoked for file resources. It > is not triggered when the resource itself cannot be found, in which -> case a SmartyException is thrown. +> case a \Smarty\Exception is thrown. <?php - + use Smarty\Smarty; $smarty = new Smarty(); $smarty->default_template_handler_func = 'my_default_template_handler_func'; diff --git a/docs/programmers/api-variables/variable-direct-access-security.md b/docs/programmers/api-variables/variable-direct-access-security.md deleted file mode 100644 index f471f5de..00000000 --- a/docs/programmers/api-variables/variable-direct-access-security.md +++ /dev/null @@ -1,13 +0,0 @@ -\$direct\_access\_security {#variable.direct.access.security} -========================== - -Direct access security inhibits direct browser access to compiled or -cached template files. - -Direct access security is enabled by default. To disable it set -`$direct_access_security` to FALSE. - -> **Note** -> -> This is a compile time option. If you change the setting you must make -> sure that the templates get recompiled. diff --git a/docs/programmers/api-variables/variable-error-reporting.md b/docs/programmers/api-variables/variable-error-reporting.md index c0aa9ced..ee28d47a 100644 --- a/docs/programmers/api-variables/variable-error-reporting.md +++ b/docs/programmers/api-variables/variable-error-reporting.md @@ -7,7 +7,7 @@ When this value is set to a non-null-value it\'s value is used as php\'s Smarty 3.1.2 introduced the [`muteExpectedErrors()`](#api.mute.expected.errors) function. Calling -`Smarty::muteExpectedErrors();` after setting up custom error handling +`\Smarty\Smarty::muteExpectedErrors();` after setting up custom error handling will ensure that warnings and notices (deliberately) produced by Smarty will not be passed to other custom error handlers. If your error logs are filling up with warnings regarding `filemtime()` or `unlink()` diff --git a/docs/programmers/api-variables/variable-plugins-dir.md b/docs/programmers/api-variables/variable-plugins-dir.md deleted file mode 100644 index 8a7cfcdb..00000000 --- a/docs/programmers/api-variables/variable-plugins-dir.md +++ /dev/null @@ -1,28 +0,0 @@ -\$plugins\_dir {#variable.plugins.dir} -============== - -This is the directory or directories where Smarty will look for the -plugins that it needs. Default is `plugins/` under the -[`SMARTY_DIR`](#constant.smarty.dir). If you supply a relative path, -Smarty will first look under the [`SMARTY_DIR`](#constant.smarty.dir), -then relative to the current working directory, then relative to the PHP -include\_path. If `$plugins_dir` is an array of directories, Smarty will -search for your plugin in each plugin directory **in the order they are -given**. - -> **Note** -> -> For best performance, do not setup your `$plugins_dir` to have to use -> the PHP include path. Use an absolute pathname, or a path relative to -> `SMARTY_DIR` or the current working directory. - -> **Note** -> -> As of Smarty 3.1 the attribute \$plugins\_dir is no longer accessible -> directly. Use [`getPluginsDir()`](#api.get.plugins.dir), -> [`setPluginsDir()`](#api.set.plugins.dir) and -> [`addPluginsDir()`](#api.add.plugins.dir) instead. - -See also [`getPluginsDir()`](#api.get.plugins.dir), -[`setPluginsDir()`](#api.set.plugins.dir) and -[`addPluginsDir()`](#api.add.plugins.dir). diff --git a/docs/programmers/api-variables/variable-template-dir.md b/docs/programmers/api-variables/variable-template-dir.md index 1db9c413..eb91d2c2 100644 --- a/docs/programmers/api-variables/variable-template-dir.md +++ b/docs/programmers/api-variables/variable-template-dir.md @@ -15,22 +15,12 @@ found. > document root. > **Note** -> -> If the directories known to `$template_dir` are relative to -> directories known to the -> [include\_path](https://www.php.net/ini.core.php#ini.include-path) you -> need to activate the [`$use_include_path`](#variable.use.include.path) -> option. - -> **Note** -> > As of Smarty 3.1 the attribute \$template\_dir is no longer accessible > directly. Use [`getTemplateDir()`](#api.get.template.dir), > [`setTemplateDir()`](#api.set.template.dir) and > [`addTemplateDir()`](#api.add.template.dir) instead. See also [`Template Resources`](#resources), -[`$use_include_path`](#variable.use.include.path), [`getTemplateDir()`](#api.get.template.dir), [`setTemplateDir()`](#api.set.template.dir) and [`addTemplateDir()`](#api.add.template.dir). diff --git a/docs/programmers/api-variables/variable-trusted-dir.md b/docs/programmers/api-variables/variable-trusted-dir.md deleted file mode 100644 index 9720ae8a..00000000 --- a/docs/programmers/api-variables/variable-trusted-dir.md +++ /dev/null @@ -1,8 +0,0 @@ -\$trusted\_dir {#variable.trusted.dir} -============== - -`$trusted_dir` is only for use when security is enabled. This is an -array of all directories that are considered trusted. Trusted -directories are where you keep php scripts that are executed directly -from the templates with -[`{insert}`](#language.function.insert.php). diff --git a/docs/programmers/api-variables/variable-use-include-path.md b/docs/programmers/api-variables/variable-use-include-path.md index 90f55f07..e69de29b 100644 --- a/docs/programmers/api-variables/variable-use-include-path.md +++ b/docs/programmers/api-variables/variable-use-include-path.md @@ -1,49 +0,0 @@ -\$use\_include\_path {#variable.use.include.path} -==================== - -This tells smarty to respect the -[include\_path](https://www.php.net/ini.core.php#ini.include-path) within -the [`File Template Resource`](#resources.file) handler and the plugin -loader to resolve the directories known to -[`$template_dir`](#variable.template.dir). The flag also makes the -plugin loader check the include\_path for -[`$plugins_dir`](#variable.plugins.dir). - -> **Note** -> -> You should not design your applications to rely on the include\_path, -> as this may - depending on your implementation - slow down your system -> (and Smarty) considerably. - -If use\_include\_path is enabled, file discovery for -[`$template_dir`](#variable.template.dir) and -[`$plugins_dir`](#variable.plugins.dir) work as follows. - -- For each element `$directory` in array (\$template\_dir or - \$plugins\_dir) do - -- Test if requested file is in `$directory` relative to the [current - working directory](https://www.php.net/function.getcwd.php). If file - found, return it. - -- For each `$path` in include\_path do - -- Test if requested file is in `$directory` relative to the `$path` - (possibly relative to the [current working - directory](https://www.php.net/function.getcwd.php)). If file found, - return it. - -- Try default\_handler or fail. - -This means that whenever a directory/file relative to the current -working directory is encountered, it is preferred over anything -potentially accessible through the include\_path. - -> **Note** -> -> Smarty does not filter elements of the include\_path. That means a -> \".:\" within your include path will trigger the current working -> directory lookup twice. - -See also [`Template Resources`](#resources) and -[`$template_dir`](#variable.template.dir) |
