diff --git a/include/smarty/.github/workflows/ci.yml b/include/smarty/.github/workflows/ci.yml deleted file mode 100644 index e27b60bfc..000000000 --- a/include/smarty/.github/workflows/ci.yml +++ /dev/null @@ -1,77 +0,0 @@ -# https://help.github.com/en/categories/automating-your-workflow-with-github-actions - -on: - - pull_request - - push - -name: CI - -jobs: - tests: - name: Tests - - runs-on: ${{ matrix.os }} - - env: - PHP_EXTENSIONS: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter - PHP_INI_VALUES: assert.exception=1, zend.assertions=1 - - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - - php-version: - - "7.1" - - "7.2" - - "7.3" - - "7.4" - - "8.0" - - "8.1" - - compiler: - - default - - include: - - os: ubuntu-latest - php-version: "8.0" - compiler: jit - - os: ubuntu-latest - php-version: "8.1" - compiler: jit - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Override PHP ini values for JIT compiler - if: matrix.compiler == 'jit' - run: echo "PHP_INI_VALUES::assert.exception=1, zend.assertions=1, opcache.enable=1, opcache.enable_cli=1, opcache.optimization_level=-1, opcache.jit=1255, opcache.jit_buffer_size=32M" >> $GITHUB_ENV - - - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - coverage: pcov - extensions: ${{ env.PHP_EXTENSIONS }} - ini-values: ${{ env.PHP_INI_VALUES }} - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v2 - with: - path: vendor - key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php-${{ matrix.php-version }}- - - - name: Install dependencies - if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer install --prefer-dist --no-progress --no-suggest - - - name: Run tests with phpunit - run: ./phpunit.sh diff --git a/include/smarty/CHANGELOG.md b/include/smarty/CHANGELOG.md index 39e834837..899cfd7e7 100644 --- a/include/smarty/CHANGELOG.md +++ b/include/smarty/CHANGELOG.md @@ -6,6 +6,72 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.3.1] - 2023-03-28 + +### Security +- Fixed Cross site scripting vulnerability in Javascript escaping. This addresses CVE-2023-28447. + +### Fixed +- `$smarty->muteUndefinedOrNullWarnings()` now also mutes PHP7 notices for undefined array indexes [#736](https://github.com/smarty-php/smarty/issues/736) +- `$smarty->muteUndefinedOrNullWarnings()` now treats undefined vars and array access of a null or false variables + equivalent across all supported PHP versions +- `$smarty->muteUndefinedOrNullWarnings()` now allows dereferencing of non-objects across all supported PHP versions [#831](https://github.com/smarty-php/smarty/issues/831) +- PHP 8.1 deprecation warnings on null strings in modifiers [#834](https://github.com/smarty-php/smarty/pull/834) + +## [4.3.0] - 2022-11-22 + +### Added +- PHP8.2 compatibility [#775](https://github.com/smarty-php/smarty/pull/775) + +### Changed +- Include docs and demo in the releases [#799](https://github.com/smarty-php/smarty/issues/799) +- Using PHP functions as modifiers now triggers a deprecation notice because we will drop support for this in the next major release [#813](https://github.com/smarty-php/smarty/issues/813) +- Dropped remaining references to removed PHP-support in Smarty 4 from docs, lexer and security class. [#816](https://github.com/smarty-php/smarty/issues/816) +- Support umask when writing (template) files and set dir permissions to 777 [#548](https://github.com/smarty-php/smarty/issues/548) [#819](https://github.com/smarty-php/smarty/issues/819) + +### Fixed +- Output buffer is now cleaned for internal PHP errors as well, not just for Exceptions [#514](https://github.com/smarty-php/smarty/issues/514) +- Fixed recursion and out of memory errors when caching in complicated template set-ups using inheritance and includes [#801](https://github.com/smarty-php/smarty/pull/801) +- Fixed PHP8.1 deprecation errors in strip_tags +- Fix Variable Usage in Exception message when unable to load subtemplate [#808](https://github.com/smarty-php/smarty/pull/808) +- Fixed PHP8.1 deprecation notices for strftime [#672](https://github.com/smarty-php/smarty/issues/672) +- Fixed PHP8.1 deprecation errors passing null to parameter in trim [#807](https://github.com/smarty-php/smarty/pull/807) +- Adapt Smarty upper/lower functions to be codesafe (e.g. for Turkish locale) [#586](https://github.com/smarty-php/smarty/pull/586) +- Bug fix for underscore and limited length in template name in custom resources [#581](https://github.com/smarty-php/smarty/pull/581) + +## [4.2.1] - 2022-09-14 + +### Security +- Applied appropriate javascript and html escaping in mailto plugin to counter injection attacks [#454](https://github.com/smarty-php/smarty/issues/454) + +### Fixed +- Fixed PHP8.1 deprecation notices in modifiers (upper, explode, number_format and replace) [#755](https://github.com/smarty-php/smarty/pull/755) and [#788](https://github.com/smarty-php/smarty/pull/788) +- Fixed PHP8.1 deprecation notices in capitalize modifier [#789](https://github.com/smarty-php/smarty/issues/789) +- Fixed use of `rand()` without a parameter in math function [#794](https://github.com/smarty-php/smarty/issues/794) +- Fixed unselected year/month/day not working in html_select_date [#395](https://github.com/smarty-php/smarty/issues/395) + +## [4.2.0] - 2022-08-01 + +### Fixed +- Fixed problems with smarty_mb_str_replace [#549](https://github.com/smarty-php/smarty/issues/549) +- Fixed second parameter of unescape modifier not working [#777](https://github.com/smarty-php/smarty/issues/777) + +### Changed +- Updated HTML of the debug template [#599](https://github.com/smarty-php/smarty/pull/599) + +## [4.1.1] - 2022-05-17 + +### Security +- Prevent PHP injection through malicious block name or include file name. This addresses CVE-2022-29221 + +### Fixed +- Exclude docs and demo from export and composer [#751](https://github.com/smarty-php/smarty/pull/751) +- PHP 8.1 deprecation notices in demo/plugins/cacheresource.pdo.php [#706](https://github.com/smarty-php/smarty/issues/706) +- PHP 8.1 deprecation notices in truncate modifier [#699](https://github.com/smarty-php/smarty/issues/699) +- Math equation `max(x, y)` didn't work anymore [#721](https://github.com/smarty-php/smarty/issues/721) +- Fix PHP 8.1 deprecated warning when calling rtrim [#743](https://github.com/smarty-php/smarty/pull/743) +- PHP 8.1: fix deprecation in escape modifier [#727](https://github.com/smarty-php/smarty/pull/727) + ## [4.1.0] - 2022-02-06 ### Added diff --git a/include/smarty/README.md b/include/smarty/README.md index 782f0b2cb..0ef3cfab6 100644 --- a/include/smarty/README.md +++ b/include/smarty/README.md @@ -7,7 +7,7 @@ Smarty is a template engine for PHP, facilitating the separation of presentation Read the [documentation](https://smarty-php.github.io/smarty/) to find out how to use it. ## Requirements -Smarty can be run with PHP 7.1 to PHP 8.1. +Smarty can be run with PHP 7.1 to PHP 8.2. ## Installation Smarty versions 3.1.11 or later can be installed with [Composer](https://getcomposer.org/). diff --git a/include/smarty/SECURITY.md b/include/smarty/SECURITY.md index d98ea0189..80b5ef5c8 100644 --- a/include/smarty/SECURITY.md +++ b/include/smarty/SECURITY.md @@ -2,18 +2,19 @@ ## Supported Versions -Smarty currently supports the latest minor version of Smarty 3 and Smarty 4. (Smarty 4 has not been released yet.) +Smarty currently supports the latest minor version of Smarty 3 and Smarty 4. | Version | Supported | -| ------- | ------------------ | -| 4.0.x | :white_check_mark: | +|---------|--------------------| +| 4.3.x | :white_check_mark: | | 3.1.x | :white_check_mark: | | < 3.1 | :x: | ## Reporting a Vulnerability - If you have discovered a security issue with Smarty, please contact us at mail [at] simonwisselink.nl. Do not - disclose your findings publicly and PLEASE PLEASE do not file an Issue. +If you have discovered a security issue with Smarty, please contact us at mail [at] simonwisselink.nl. Do not +disclose your findings publicly and **PLEASE** do not file an Issue (because that would disclose your findings +publicly.) We will try to confirm the vulnerability and develop a fix if appropriate. When we release the fix, we will publish a security release. Please let us know if you want to be credited. diff --git a/include/smarty/docs/appendixes/tips.md b/include/smarty/docs/appendixes/tips.md index b0ea40cc7..3c6e6b96f 100644 --- a/include/smarty/docs/appendixes/tips.md +++ b/include/smarty/docs/appendixes/tips.md @@ -1,23 +1,22 @@ -Tips & Tricks {#tips} -============= +# Tips & Tricks -Blank Variable Handling {#tips.blank.var.handling} -======================= +## Blank Variable Handling There may be times when you want to print a default value for an empty variable instead of printing nothing, such as printing ` ` so that html table backgrounds work properly. Many would use an -[`{if}`](#language.function.if) statement to handle this, but there is a +[`{if}`](../designers/language-builtin-functions/language-function-if.md) statement to handle this, but there is a shorthand way with Smarty, using the -[`default`](#language.modifier.default) variable modifier. +[`default`](../designers/language-modifiers/language-modifier-default.md) variable modifier. > **Note** > > "Undefined variable" errors will show an E\_NOTICE if not disabled in -> PHP\'s [`error_reporting()`](&url.php-manual;error_reporting) level or -> Smarty\'s [`$error_reporting`](#variable.error.reporting) property and +> PHP's [`error_reporting()`](https://www.php.net/error_reporting) level or +> Smarty's [`$error_reporting`](../programmers/api-variables/variable-error-reporting.md) property and > a variable had not been assigned to Smarty. +```smarty {* the long way *} {if $title eq ''} @@ -29,19 +28,18 @@ shorthand way with Smarty, using the {* the short way *} {$title|default:' '} - +``` -See also [`default`](#language.modifier.default) modifier and [default -variable handling](#tips.default.var.handling). +See also [`default`](../designers/language-modifiers/language-modifier-default.md) modifier and [default +variable handling](#default-variable-handling). -Default Variable Handling {#tips.default.var.handling} -========================= +## Default Variable Handling If a variable is used frequently throughout your templates, applying the -[`default`](#language.modifier.default) modifier every time it is +[`default`](../designers/language-modifiers/language-modifier-default.md) modifier every time it is mentioned can get a bit ugly. You can remedy this by assigning the variable its default value with the -[`{assign}`](#language.function.assign) function. +[`{assign}`](../designers/language-builtin-functions/language-function-assign.md) function. {* do this somewhere at the top of your template *} @@ -52,214 +50,159 @@ variable its default value with the -See also [`default`](#language.modifier.default) modifier and [blank -variable handling](#tips.blank.var.handling). +See also [`default`](../designers/language-modifiers/language-modifier-default.md) modifier and [blank +variable handling](#blank-variable-handling). -Passing variable title to header template {#tips.passing.vars} -========================================= +## Passing variable title to header template When the majority of your templates use the same headers and footers, it is common to split those out into their own templates and -[`{include}`](#language.function.include) them. But what if the header +[`{include}`](../designers/language-builtin-functions/language-function-include.md) them. But what if the header needs to have a different title, depending on what page you are coming from? You can pass the title to the header as an -[attribute](#language.syntax.attributes) when it is included. +[attribute](../designers/language-basic-syntax/language-syntax-attributes.md) when it is included. `mainpage.tpl` - When the main page is drawn, the title of "Main Page" is passed to the `header.tpl`, and will subsequently be used as the title. +```smarty - {include file='header.tpl' title='Main Page'} - {* template body goes here *} - {include file='footer.tpl'} +{include file='header.tpl' title='Main Page'} +{* template body goes here *} +{include file='footer.tpl'} - +``` `archives.tpl` - When the archives page is drawn, the title will be "Archives". Notice in the archive example, we are using a variable from the `archives_page.conf` file instead of a hard coded variable. +```smarty - {config_load file='archive_page.conf'} +{config_load file='archive_page.conf'} - {include file='header.tpl' title=#archivePageTitle#} - {* template body goes here *} - {include file='footer.tpl'} +{include file='header.tpl' title=#archivePageTitle#} +{* template body goes here *} +{include file='footer.tpl'} +``` `header.tpl` - Notice that "Smarty News" is printed if the `$title` -variable is not set, using the [`default`](#language.modifier.default) +variable is not set, using the [`default`](../designers/language-modifiers/language-modifier-default.md) variable modifier. +```smarty - + - {$title|default:'Smarty News'} + {$title|default:'Smarty News'} - - + + +``` `footer.tpl` +```smarty - + +``` -Dates {#tips.dates} -===== +## Dates As a rule of thumb, always pass dates to Smarty as -[timestamps](&url.php-manual;time). This allows template designers to -use the [`date_format`](#language.modifier.date.format) modifier for +[timestamps](https://www.php.net/time). This allows template designers to +use the [`date_format`](../designers/language-modifiers/language-modifier-date-format.md) modifier for full control over date formatting, and also makes it easy to compare dates if necessary. - - {$startDate|date_format} - +```smarty +{$startDate|date_format} +``` This will output: +``` +Jan 4, 2009 +``` - Jan 4, 2009 +```smarty - - - - {$startDate|date_format:"%Y/%m/%d"} +{$startDate|date_format:"%Y/%m/%d"} +``` This will output: - - 2009/01/04 - - +``` +2009/01/04 +``` Dates can be compared in the template by timestamps with: +```smarty - {if $order_date < $invoice_date} - ...do something.. - {/if} +{if $order_date < $invoice_date} + ...do something.. +{/if} - +``` -When using [`{html_select_date}`](#language.function.html.select.date) +When using [`{html_select_date}`](../designers/language-custom-functions/language-function-html-select-date.md) in a template, the programmer will most likely want to convert the output from the form back into timestamp format. Here is a function to help you with that. +```php - + return mktime(0, 0, 0, $month, $day, $year); +} - +``` + -See also [`{html_select_date}`](#language.function.html.select.date), -[`{html_select_time}`](#language.function.html.select.time), -[`date_format`](#language.modifier.date.format) and -[`$smarty.now`](#language.variables.smarty.now), +See also [`{html_select_date}`](../designers/language-custom-functions/language-function-html-select-date.md), +[`{html_select_time}`](../designers/language-custom-functions/language-function-html-select-time.md), +[`date_format`](../designers/language-modifiers/language-modifier-date-format.md) and +[`$smarty.now`](../designers/language-variables/language-variables-smarty.md#smarty-now), -WAP/WML {#tips.wap} -======= - -WAP/WML templates require a php [Content-Type -header](&url.php-manual;header) to be passed along with the template. -The easist way to do this would be to write a custom function that -prints the header. If you are using [caching](#caching), that won\'t -work so we\'ll do it using the [`{insert}`](#language.function.insert) -tag; remember `{insert}` tags are not cached! Be sure that there is -nothing output to the browser before the template, or else the header -may fail. - - - - - - -your Smarty template *must* begin with the insert tag : - - - {insert name=header content="Content-Type: text/vnd.wap.wml"} - - - - - - - - - - - -

- Welcome to WAP with Smarty! - Press OK to continue... -

-
- - -

- Pretty easy isn't it? -

-
-
- - - -Componentized Templates {#tips.componentized.templates} -======================= +## Componentized Templates Traditionally, programming templates into your applications goes as follows: First, you accumulate your variables within your PHP application, (maybe with database queries.) Then, you instantiate your -Smarty object, [`assign()`](#api.assign) the variables and -[`display()`](#api.display) the template. So lets say for example we +Smarty object, [`assign()`](../programmers/api-functions/api-assign.md) the variables and +[`display()`](../programmers/api-functions/api-display.md) the template. So lets say for example we have a stock ticker on our template. We would collect the stock data in our application, then assign these variables in the template and display -it. Now wouldn\'t it be nice if you could add this stock ticker to any +it. Now wouldn't it be nice if you could add this stock ticker to any application by merely including the template, and not worry about fetching the data up front? @@ -267,60 +210,59 @@ You can do this by writing a custom plugin for fetching the content and assigning it to a template variable. `function.load_ticker.php` - drop file in -[`$plugins directory`](#variable.plugins.dir) +[`$plugins directory`](../programmers/api-variables/variable-plugins-dir.md) +```php - assign($params['assign'], $ticker_info); - } - ?> + // assign template variable + $smarty->assign($params['assign'], $ticker_info); +} - +``` `index.tpl` +```smarty - {load_ticker symbol='SMARTY' assign='ticker'} +{load_ticker symbol='SMARTY' assign='ticker'} - Stock Name: {$ticker.name} Stock Price: {$ticker.price} +Stock Name: {$ticker.name} Stock Price: {$ticker.price} - +``` -See also [`{include_php}`](#language.function.include.php), -[`{include}`](#language.function.include) and -[`{php}`](#language.function.php). +See also: [`{include}`](../designers/language-builtin-functions/language-function-include.md). -Obfuscating E-mail Addresses {#tips.obfuscating.email} -============================ +## Obfuscating E-mail Addresses Do you ever wonder how your email address gets on so many spam mailing lists? One way spammers collect email addresses is from web pages. To help combat this problem, you can make your email address show up in scrambled javascript in the HTML source, yet it it will look and work correctly in the browser. This is done with the -[`{mailto}`](#language.function.mailto) plugin. +[`{mailto}`](../designers/language-custom-functions/language-function-mailto.md) plugin. +```smarty -
Send inquiries to - {mailto address=$EmailAddress encode='javascript' subject='Hello'} -
+
Send inquiries to +{mailto address=$EmailAddress encode='javascript' subject='Hello'} +
- +``` > **Note** > @@ -328,5 +270,5 @@ correctly in the browser. This is done with the > his e-mail collector to decode these values, but not likely\.... > hopefully..yet \... wheres that quantum computer :-?. -See also [`escape`](#language.modifier.escape) modifier and -[`{mailto}`](#language.function.mailto). +See also [`escape`](../designers/language-modifiers/language-modifier-escape.md) modifier and +[`{mailto}`](../designers/language-custom-functions/language-function-mailto.md). diff --git a/include/smarty/docs/appendixes/troubleshooting.md b/include/smarty/docs/appendixes/troubleshooting.md index fe012c12c..8364534af 100644 --- a/include/smarty/docs/appendixes/troubleshooting.md +++ b/include/smarty/docs/appendixes/troubleshooting.md @@ -1,20 +1,18 @@ -Troubleshooting -=============== +# Troubleshooting -Smarty/PHP errors {#smarty.php.errors} -================= +## Smarty/PHP errors Smarty can catch many errors such as missing tag attributes or malformed variable names. If this happens, you will see an error similar to the following: +``` +Warning: Smarty: [in index.tpl line 4]: syntax error: unknown tag - '%blah' + in /path/to/smarty/Smarty.class.php on line 1041 - Warning: Smarty: [in index.tpl line 4]: syntax error: unknown tag - '%blah' - in /path/to/smarty/Smarty.class.php on line 1041 - - Fatal error: Smarty: [in index.tpl line 28]: syntax error: missing section name - in /path/to/smarty/Smarty.class.php on line 1041 - +Fatal error: Smarty: [in index.tpl line 28]: syntax error: missing section name + in /path/to/smarty/Smarty.class.php on line 1041 +``` Smarty shows you the template name, the line number and the error. After @@ -25,96 +23,82 @@ There are certain errors that Smarty cannot catch, such as missing close tags. These types of errors usually end up in PHP compile-time parsing errors. - - Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75 - - - +`Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75` + When you encounter a PHP parsing error, the error line number will correspond to the compiled PHP script, NOT the template itself. Usually you can look at the template and spot the syntax error. Here are some common things to look for: missing close tags for -[`{if}{/if}`](#language.function.if) or -[`{section}{/section}`](#language.function.if), or syntax of logic -within an `{if}` tag. If you can\'t find the error, you might have to +[`{if}{/if}`](../designers/language-builtin-functions/language-function-if.md) or +[`{section}{/section}`](../designers/language-builtin-functions/language-function-section.md), +or syntax of logic within an `{if}` tag. If you can\'t find the error, you might have to open the compiled PHP file and go to the line number to figure out where the corresponding error is in the template. +``` +Warning: Smarty error: unable to read resource: "index.tpl" in... +``` +or +``` +Warning: Smarty error: unable to read resource: "site.conf" in... +``` - Warning: Smarty error: unable to read resource: "index.tpl" in... - or - Warning: Smarty error: unable to read resource: "site.conf" in... - -- The [`$template_dir`](#variable.template.dir) is incorrect, doesn\'t +- The [`$template_dir`](../programmers/api-variables/variable-template-dir.md) is incorrect, doesn't exist or the file `index.tpl` is not in the `templates/` directory -- A [`{config_load}`](#language.function.config.load) function is - within a template (or [`configLoad()`](#api.config.load) has been - called) and either [`$config_dir`](#variable.config.dir) is +- A [`{config_load}`](../designers/language-builtin-functions/language-function-config-load.md) function is + within a template (or [`configLoad()`](../programmers/api-functions/api-config-load.md) has been + called) and either [`$config_dir`](../programmers/api-variables/variable-config-dir.md) is incorrect, does not exist or `site.conf` is not in the directory. - +``` +Fatal error: Smarty error: the $compile_dir 'templates_c' does not exist, +or is not a directory... +``` - - Fatal error: Smarty error: the $compile_dir 'templates_c' does not exist, - or is not a directory... - - - -- Either the [`$compile_dir`](#variable.compile.dir)is incorrectly +- Either the [`$compile_dir`](../programmers/api-variables/variable-compile-dir.md)is incorrectly set, the directory does not exist, or `templates_c` is a file and not a directory. - - - - Fatal error: Smarty error: unable to write to $compile_dir '.... - +``` +Fatal error: Smarty error: unable to write to $compile_dir '.... +``` -- The [`$compile_dir`](#variable.compile.dir) is not writable by the +- The [`$compile_dir`](../programmers/api-variables/variable-compile-dir.md) is not writable by the web server. See the bottom of the [installing - smarty](#installing.smarty.basic) page for more about permissions. - - - - - Fatal error: Smarty error: the $cache_dir 'cache' does not exist, - or is not a directory. in /.. + smarty](../getting-started.md#installation) page for more about permissions. +``` +Fatal error: Smarty error: the $cache_dir 'cache' does not exist, +or is not a directory. in /.. +``` - -- This means that [`$caching`](#variable.caching) is enabled and - either; the [`$cache_dir`](#variable.cache.dir) is incorrectly set, +- This means that [`$caching`](../programmers/api-variables/variable-caching.md) is enabled and + either; the [`$cache_dir`](../programmers/api-variables/variable-cache-dir.md) is incorrectly set, the directory does not exist, or `cache/` is a file and not a directory. - +``` +Fatal error: Smarty error: unable to write to $cache_dir '/... +``` - - Fatal error: Smarty error: unable to write to $cache_dir '/... - - - -- This means that [`$caching`](#variable.caching) is enabled and the - [`$cache_dir`](#variable.cache.dir) is not writable by the web +- This means that [`$caching`](../programmers/api-variables/variable-caching.md) is enabled and the + [`$cache_dir`](../programmers/api-variables/variable-cache-dir.md) is not writable by the web server. See the bottom of the [installing - smarty](#installing.smarty.basic) page for permissions. + smarty](../getting-started.md#installation) page for permissions. - +``` +Warning: filemtime(): stat failed for /path/to/smarty/cache/3ab50a623e65185c49bf17c63c90cc56070ea85c.one.tpl.php +in /path/to/smarty/libs/sysplugins/smarty_resource.php +``` - - Warning: filemtime(): stat failed for /path/to/smarty/cache/3ab50a623e65185c49bf17c63c90cc56070ea85c.one.tpl.php - in /path/to/smarty/libs/sysplugins/smarty_resource.php - - - -- This means that your application registered a custom error hander - (using [set\_error\_handler()](&url.php-manual;set_error_handler)) +- This means that your application registered a custom error handler + (using [set_error_handler()](https://www.php.net/set_error_handler)) which is not respecting the given `$errno` as it should. If, for whatever reason, this is the desired behaviour of your custom error handler, please call - [`muteExpectedErrors()`](#api.mute.expected.errors) after you\'ve + [`muteExpectedErrors()`](../programmers/api-functions/api-mute-expected-errors.md) after you've registered your custom error handler. -See also [debugging](#chapter.debugging.console). +See also [debugging](../designers/chapter-debugging-console.md). diff --git a/include/smarty/docs/designers/chapter-debugging-console.md b/include/smarty/docs/designers/chapter-debugging-console.md index 6429b4876..6704fce2f 100644 --- a/include/smarty/docs/designers/chapter-debugging-console.md +++ b/include/smarty/docs/designers/chapter-debugging-console.md @@ -1,5 +1,4 @@ -Debugging Console {#chapter.debugging.console} -================= +# Debugging Console There is a debugging console included with Smarty. The console informs you of all the [included](./language-builtin-functions/language-function-include.md) templates, diff --git a/include/smarty/docs/designers/config-files.md b/include/smarty/docs/designers/config-files.md index c840e3a67..1e1db2d5a 100644 --- a/include/smarty/docs/designers/config-files.md +++ b/include/smarty/docs/designers/config-files.md @@ -1,5 +1,4 @@ -Config Files {#config.files} -============ +# Config Files Config files are handy for designers to manage global template variables from one file. One example is template colors. Normally if you wanted to @@ -8,39 +7,38 @@ each and every template file and change the colors. With a config file, the colors can be kept in one place, and only one file needs to be updated. +```ini +# global variables +pageTitle = "Main Menu" +bodyBgColor = #000000 +tableBgColor = #000000 +rowBgColor = #00ff00 - # global variables - pageTitle = "Main Menu" - bodyBgColor = #000000 - tableBgColor = #000000 - rowBgColor = #00ff00 +[Customer] +pageTitle = "Customer Info" - [Customer] - pageTitle = "Customer Info" - - [Login] - pageTitle = "Login" - focus = "username" - Intro = """This is a value that spans more - than one line. you must enclose - it in triple quotes.""" - - # hidden section - [.Database] - host=my.example.com - db=ADDRESSBOOK - user=php-user - pass=foobar +[Login] +pageTitle = "Login" +focus = "username" +Intro = """This is a value that spans more + than one line. you must enclose + it in triple quotes.""" +# hidden section +[.Database] +host=my.example.com +db=ADDRESSBOOK +user=php-user +pass=foobar +``` Values of [config file variables](./language-variables/language-config-variables.md) can be in quotes, but not necessary. You can use either single or double quotes. If you have a value that spans more than one line, enclose the entire -value with triple quotes (\"\"\"). You can put comments into config +value with triple quotes \("""\). You can put comments into config files by any syntax that is not a valid config file syntax. We recommend -using a ` - #` (hash) at the beginning of the line. +using a `#` (hash) at the beginning of the line. The example config file above has two sections. Section names are enclosed in \[brackets\]. Section names can be arbitrary strings not @@ -54,8 +52,7 @@ the last one will be used unless [`$config_overwrite`](../programmers/api-variables/variable-config-overwrite.md) is disabled. Config files are loaded into templates with the built-in template -function [` - {config_load}`](./language-builtin-functions/language-function-config-load.md) or the API +function [`{config_load}`](./language-builtin-functions/language-function-config-load.md) or the API [`configLoad()`](../programmers/api-functions/api-config-load.md) function. You can hide variables or entire sections by prepending the variable diff --git a/include/smarty/docs/designers/language-basic-syntax.md b/include/smarty/docs/designers/language-basic-syntax/index.md similarity index 56% rename from include/smarty/docs/designers/language-basic-syntax.md rename to include/smarty/docs/designers/language-basic-syntax/index.md index 2509857c3..c0a12a9be 100644 --- a/include/smarty/docs/designers/language-basic-syntax.md +++ b/include/smarty/docs/designers/language-basic-syntax/index.md @@ -1,8 +1,7 @@ -Basic Syntax -============ +# Basic Syntax A simple Smarty template could look like this: -```html +```smarty

{$title|escape}