WIP improving the docs

This commit is contained in:
Simon Wisselink
2023-02-05 23:14:10 +01:00
parent 51ed0d6791
commit 1e0d25638e
25 changed files with 705 additions and 765 deletions

View File

@ -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 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 variable instead of printing nothing, such as printing ` ` so that
html table backgrounds work properly. Many would use an 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 shorthand way with Smarty, using the
[`default`](#language.modifier.default) variable modifier. [`default`](../designers/language-modifiers/language-modifier-default.md) variable modifier.
> **Note** > **Note**
> >
> "Undefined variable" errors will show an E\_NOTICE if not disabled in > "Undefined variable" errors will show an E\_NOTICE if not disabled in
> PHP\'s [`error_reporting()`](https://www.php.net/error_reporting) level or > PHP's [`error_reporting()`](https://www.php.net/error_reporting) level or
> Smarty\'s [`$error_reporting`](#variable.error.reporting) property and > Smarty's [`$error_reporting`](../programmers/api-variables/variable-error-reporting.md) property and
> a variable had not been assigned to Smarty. > a variable had not been assigned to Smarty.
```smarty
{* the long way *} {* the long way *}
{if $title eq ''} {if $title eq ''}
@ -29,19 +28,18 @@ shorthand way with Smarty, using the
{* the short way *} {* the short way *}
{$title|default:' '} {$title|default:' '}
```
See also [`default`](#language.modifier.default) modifier and [default See also [`default`](../designers/language-modifiers/language-modifier-default.md) modifier and [default
variable handling](#tips.default.var.handling). 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 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 mentioned can get a bit ugly. You can remedy this by assigning the
variable its default value with 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 *} {* do this somewhere at the top of your template *}
@ -52,150 +50,156 @@ variable its default value with the
See also [`default`](#language.modifier.default) modifier and [blank See also [`default`](../designers/language-modifiers/language-modifier-default.md) modifier and [blank
variable handling](#tips.blank.var.handling). 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 When the majority of your templates use the same headers and footers, it
is common to split those out into their own templates and 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 needs to have a different title, depending on what page you are coming
from? You can pass the title to the header as an 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" `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 is passed to the `header.tpl`, and will subsequently be used as the
title. title.
```smarty
{include file='header.tpl' title='Main Page'} {include file='header.tpl' title='Main Page'}
{* template body goes here *} {* template body goes here *}
{include file='footer.tpl'} {include file='footer.tpl'}
```
`archives.tpl` - When the archives page is drawn, the title will be `archives.tpl` - When the archives page is drawn, the title will be
"Archives". Notice in the archive example, we are using a variable from "Archives". Notice in the archive example, we are using a variable from
the `archives_page.conf` file instead of a hard coded variable. 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#} {include file='header.tpl' title=#archivePageTitle#}
{* template body goes here *} {* template body goes here *}
{include file='footer.tpl'} {include file='footer.tpl'}
```
`header.tpl` - Notice that "Smarty News" is printed if the `$title` `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. variable modifier.
```smarty
<html> <html>
<head> <head>
<title>{$title|default:'Smarty News'}</title> <title>{$title|default:'Smarty News'}</title>
</head> </head>
<body> <body>
```
`footer.tpl` `footer.tpl`
```smarty
</body> </body>
</html> </html>
```
Dates {#tips.dates} ## Dates
=====
As a rule of thumb, always pass dates to Smarty as As a rule of thumb, always pass dates to Smarty as
[timestamps](https://www.php.net/time). This allows template designers to [timestamps](https://www.php.net/time). This allows template designers to
use the [`date_format`](#language.modifier.date.format) modifier for 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 full control over date formatting, and also makes it easy to compare
dates if necessary. dates if necessary.
```smarty
{$startDate|date_format} {$startDate|date_format}
```
This will output: 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: This will output:
```
2009/01/04 2009/01/04
```
Dates can be compared in the template by timestamps with: Dates can be compared in the template by timestamps with:
```smarty
{if $order_date < $invoice_date} {if $order_date < $invoice_date}
...do something.. ...do something..
{/if} {/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 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 output from the form back into timestamp format. Here is a function to
help you with that. help you with that.
```php
<?php <?php
// this assumes your form elements are named // this assumes your form elements are named
// startDate_Day, startDate_Month, startDate_Year // startDate_Day, startDate_Month, startDate_Year
$startDate = makeTimeStamp($startDate_Year, $startDate_Month, $startDate_Day); $startDate = makeTimeStamp($startDate_Year, $startDate_Month, $startDate_Day);
function makeTimeStamp($year='', $month='', $day='') function makeTimeStamp($year='', $month='', $day='')
{ {
if(empty($year)) { if(empty($year)) {
$year = strftime('%Y'); $year = strftime('%Y');
} }
if(empty($month)) { if(empty($month)) {
$month = strftime('%m'); $month = strftime('%m');
} }
if(empty($day)) { if(empty($day)) {
$day = strftime('%d'); $day = strftime('%d');
} }
return mktime(0, 0, 0, $month, $day, $year); return mktime(0, 0, 0, $month, $day, $year);
} }
?>
```
See also [`{html_select_date}`](#language.function.html.select.date), See also [`{html_select_date}`](../designers/language-custom-functions/language-function-html-select-date.md),
[`{html_select_time}`](#language.function.html.select.time), [`{html_select_time}`](../designers/language-custom-functions/language-function-html-select-time.md),
[`date_format`](#language.modifier.date.format) and [`date_format`](../designers/language-modifiers/language-modifier-date-format.md) and
[`$smarty.now`](#language.variables.smarty.now), [`$smarty.now`](../designers/language-variables/language-variables-smarty.md#smarty-now),
Componentized Templates {#tips.componentized.templates} ## Componentized Templates
=======================
Traditionally, programming templates into your applications goes as Traditionally, programming templates into your applications goes as
follows: First, you accumulate your variables within your PHP follows: First, you accumulate your variables within your PHP
application, (maybe with database queries.) Then, you instantiate your application, (maybe with database queries.) Then, you instantiate your
Smarty object, [`assign()`](#api.assign) the variables and Smarty object, [`assign()`](../programmers/api-functions/api-assign.md) the variables and
[`display()`](#api.display) the template. So lets say for example we [`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 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 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
@ -206,58 +210,59 @@ You can do this by writing a custom plugin for fetching the content and
assigning it to a template variable. assigning it to a template variable.
`function.load_ticker.php` - drop file in `function.load_ticker.php` - drop file in
[`$plugins directory`](#variable.plugins.dir) [`$plugins directory`](../programmers/api-variables/variable-plugins-dir.md)
```php
<?php <?php
// setup our function for fetching stock data // setup our function for fetching stock data
function fetch_ticker($symbol) function fetch_ticker($symbol)
{ {
// put logic here that fetches $ticker_info // put logic here that fetches $ticker_info
// from some ticker resource // from some ticker resource
return $ticker_info; return $ticker_info;
} }
function smarty_function_load_ticker($params, $smarty) function smarty_function_load_ticker($params, $smarty)
{ {
// call the function // call the function
$ticker_info = fetch_ticker($params['symbol']); $ticker_info = fetch_ticker($params['symbol']);
// assign template variable // assign template variable
$smarty->assign($params['assign'], $ticker_info); $smarty->assign($params['assign'], $ticker_info);
} }
?>
```
`index.tpl` `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}`](#language.function.include). 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 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 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 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 scrambled javascript in the HTML source, yet it it will look and work
correctly in the browser. This is done with the 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
<div id="contact">Send inquiries to <div id="contact">Send inquiries to
{mailto address=$EmailAddress encode='javascript' subject='Hello'} {mailto address=$EmailAddress encode='javascript' subject='Hello'}
</div> </div>
```
> **Note** > **Note**
> >
@ -265,5 +270,5 @@ correctly in the browser. This is done with the
> his e-mail collector to decode these values, but not likely\.... > his e-mail collector to decode these values, but not likely\....
> hopefully..yet \... wheres that quantum computer :-?. > hopefully..yet \... wheres that quantum computer :-?.
See also [`escape`](#language.modifier.escape) modifier and See also [`escape`](../designers/language-modifiers/language-modifier-escape.md) modifier and
[`{mailto}`](#language.function.mailto). [`{mailto}`](../designers/language-custom-functions/language-function-mailto.md).

View File

@ -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 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 variable names. If this happens, you will see an error similar to the
following: 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' Fatal error: Smarty: [in index.tpl line 28]: syntax error: missing section name
in /path/to/smarty/Smarty.class.php on line 1041 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 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 tags. These types of errors usually end up in PHP compile-time parsing
errors. 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 When you encounter a PHP parsing error, the error line number will
correspond to the compiled PHP script, NOT the template itself. Usually 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 you can look at the template and spot the syntax error. Here are some
common things to look for: missing close tags for common things to look for: missing close tags for
[`{if}{/if}`](#language.function.if) or [`{if}{/if}`](../designers/language-builtin-functions/language-function-if.md) or
[`{section}{/section}`](#language.function.if), or syntax of logic [`{section}{/section}`](../designers/language-builtin-functions/language-function-section.md),
within an `{if}` tag. If you can\'t find the error, you might have to 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 open the compiled PHP file and go to the line number to figure out where
the corresponding error is in the template. 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... - The [`$template_dir`](../programmers/api-variables/variable-template-dir.md) is incorrect, doesn't
or
Warning: Smarty error: unable to read resource: "site.conf" in...
- The [`$template_dir`](#variable.template.dir) is incorrect, doesn\'t
exist or the file `index.tpl` is not in the `templates/` directory exist or the file `index.tpl` is not in the `templates/` directory
- A [`{config_load}`](#language.function.config.load) function is - A [`{config_load}`](../designers/language-builtin-functions/language-function-config-load.md) function is
within a template (or [`configLoad()`](#api.config.load) has been within a template (or [`configLoad()`](../programmers/api-functions/api-config-load.md) has been
called) and either [`$config_dir`](#variable.config.dir) is 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. 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...
```
- Either the [`$compile_dir`](../programmers/api-variables/variable-compile-dir.md)is incorrectly
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
set, the directory does not exist, or `templates_c` is a file and set, the directory does not exist, or `templates_c` is a file and
not a directory. 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 web server. See the bottom of the [installing
smarty](#installing.smarty.basic) page for more about permissions. 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 /..
```
Fatal error: Smarty error: the $cache_dir 'cache' does not exist,
or is not a directory. in /..
```
- This means that [`$caching`](../programmers/api-variables/variable-caching.md) is enabled and
- This means that [`$caching`](#variable.caching) is enabled and either; the [`$cache_dir`](../programmers/api-variables/variable-cache-dir.md) is incorrectly set,
either; the [`$cache_dir`](#variable.cache.dir) is incorrectly set,
the directory does not exist, or `cache/` is a file and not a the directory does not exist, or `cache/` is a file and not a
directory. directory.
<!-- --> ```
Fatal error: Smarty error: unable to write to $cache_dir '/...
```
- This means that [`$caching`](../programmers/api-variables/variable-caching.md) is enabled and the
Fatal error: Smarty error: unable to write to $cache_dir '/... [`$cache_dir`](../programmers/api-variables/variable-cache-dir.md) is not writable by the web
- This means that [`$caching`](#variable.caching) is enabled and the
[`$cache_dir`](#variable.cache.dir) is not writable by the web
server. See the bottom of the [installing 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 handler - This means that your application registered a custom error handler
(using [set\_error\_handler()](https://www.php.net/set_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 which is not respecting the given `$errno` as it should. If, for
whatever reason, this is the desired behaviour of your custom error whatever reason, this is the desired behaviour of your custom error
handler, please call 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. registered your custom error handler.
See also [debugging](#chapter.debugging.console). See also [debugging](../designers/chapter-debugging-console.md).

View File

@ -1,5 +1,4 @@
Debugging Console {#chapter.debugging.console} # Debugging Console
=================
There is a debugging console included with Smarty. The console informs There is a debugging console included with Smarty. The console informs
you of all the [included](./language-builtin-functions/language-function-include.md) templates, you of all the [included](./language-builtin-functions/language-function-include.md) templates,

View File

@ -1,5 +1,4 @@
Config Files {#config.files} # Config Files
============
Config files are handy for designers to manage global template variables Config files are handy for designers to manage global template variables
from one file. One example is template colors. Normally if you wanted to 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 the colors can be kept in one place, and only one file needs to be
updated. updated.
```ini
# global variables
pageTitle = "Main Menu"
bodyBgColor = #000000
tableBgColor = #000000
rowBgColor = #00ff00
# global variables [Customer]
pageTitle = "Main Menu" pageTitle = "Customer Info"
bodyBgColor = #000000
tableBgColor = #000000
rowBgColor = #00ff00
[Customer] [Login]
pageTitle = "Customer Info" pageTitle = "Login"
focus = "username"
[Login] Intro = """This is a value that spans more
pageTitle = "Login" than one line. you must enclose
focus = "username" it in triple quotes."""
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
# 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 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. 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 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 files by any syntax that is not a valid config file syntax. We recommend
using a ` using a `#` (hash) at the beginning of the line.
#` (hash) at the beginning of the line.
The example config file above has two sections. Section names are The example config file above has two sections. Section names are
enclosed in \[brackets\]. Section names can be arbitrary strings not 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_overwrite`](../programmers/api-variables/variable-config-overwrite.md) is disabled.
Config files are loaded into templates with the built-in template Config files are loaded into templates with the built-in template
function [` function [`{config_load}`](./language-builtin-functions/language-function-config-load.md) or the API
{config_load}`](./language-builtin-functions/language-function-config-load.md) or the API
[`configLoad()`](../programmers/api-functions/api-config-load.md) function. [`configLoad()`](../programmers/api-functions/api-config-load.md) function.
You can hide variables or entire sections by prepending the variable You can hide variables or entire sections by prepending the variable

View File

@ -1,8 +1,7 @@
Basic Syntax # Basic Syntax
============
A simple Smarty template could look like this: A simple Smarty template could look like this:
```html ```smarty
<h1>{$title|escape}</h1> <h1>{$title|escape}</h1>
<ul> <ul>
{foreach $cities as $city} {foreach $cities as $city}
@ -15,7 +14,7 @@ A simple Smarty template could look like this:
All Smarty template tags are enclosed within delimiters. By default All Smarty template tags are enclosed within delimiters. By default
these are `{` and `}`, but they can be these are `{` and `}`, but they can be
[changed](../programmers/api-variables/variable-left-delimiter.md). [changed](../../programmers/api-variables/variable-left-delimiter.md).
For the examples in this manual, we will assume that you are using the For the examples in this manual, we will assume that you are using the
default delimiters. In Smarty, all content outside of delimiters is default delimiters. In Smarty, all content outside of delimiters is
@ -24,10 +23,11 @@ template tags, it attempts to interpret them, and displays the
appropriate output in their place. appropriate output in their place.
The basis components of the Smarty syntax are: The basis components of the Smarty syntax are:
- [Comments](./language-basic-syntax/language-syntax-comments.md)
- [Variables](./language-basic-syntax/language-syntax-variables.md) - [Comments](language-syntax-comments.md)
- [Functions](./language-basic-syntax/language-syntax-functions.md) - [Variables](language-syntax-variables.md)
- [Attributes](./language-basic-syntax/language-syntax-attributes.md) - [Functions](language-syntax-functions.md)
- [Quotes](./language-basic-syntax/language-syntax-quotes.md) - [Attributes](language-syntax-attributes.md)
- [Math](./language-basic-syntax/language-math.md) - [Quotes](language-syntax-quotes.md)
- [Escaping](./language-basic-syntax/language-escaping.md) - [Math](language-math.md)
- [Escaping](language-escaping.md)

View File

@ -1,5 +1,4 @@
Escaping Smarty Parsing {#language.escaping} # Escaping Smarty Parsing
=======================
It is sometimes desirable or even necessary to have Smarty ignore It is sometimes desirable or even necessary to have Smarty ignore
sections it would otherwise parse. A classic example is embedding sections it would otherwise parse. A classic example is embedding

View File

@ -1,38 +0,0 @@
Built-in Functions {#language.builtin.functions}
==================
## Table of contents
- [{$var=...}](./language-builtin-functions/language-function-shortform-assign.md)
- [{append}](./language-builtin-functions/language-function-append.md)
- [{assign}](./language-builtin-functions/language-function-assign.md)
- [{block}](./language-builtin-functions/language-function-block.md)
- [{call}](./language-builtin-functions/language-function-call.md)
- [{capture}](./language-builtin-functions/language-function-capture.md)
- [{config_load}](./language-builtin-functions/language-function-config-load.md)
- [{debug}](./language-builtin-functions/language-function-debug.md)
- [{extends}](./language-builtin-functions/language-function-extends.md)
- [{for}](./language-builtin-functions/language-function-for.md)
- [{foreach},{foreachelse}](./language-builtin-functions/language-function-foreach.md)
- [{function}](./language-builtin-functions/language-function-function.md)
- [{if},{elseif},{else}](./language-builtin-functions/language-function-if.md)
- [{include}](./language-builtin-functions/language-function-include.md)
- [{insert}](./language-builtin-functions/language-function-insert.md)
- [{ldelim},{rdelim}](./language-builtin-functions/language-function-ldelim.md)
- [{literal}](./language-builtin-functions/language-function-literal.md)
- [{nocache}](./language-builtin-functions/language-function-nocache.md)
- [{section},{sectionelse}](./language-builtin-functions/language-function-section.md)
- [{setfilter}](./language-builtin-functions/language-function-setfilter.md)
- [{strip}](./language-builtin-functions/language-function-strip.md)
- [{while}](./language-builtin-functions/language-function-while.md)
Smarty comes with several built-in functions. These built-in functions
are the integral part of the smarty template engine. They are compiled
into corresponding inline PHP code for maximum performance.
You cannot create your own [custom
functions](./language-custom-functions.md) with the same name; and you
should not need to modify the built-in functions.
A few of these functions have an `assign` attribute which collects the
result the function to a named template variable instead of being
output; much like the [`{assign}`](./language-builtin-functions/language-function-assign.md) function.

View File

@ -0,0 +1,35 @@
# Built-in Functions
Smarty comes with several built-in functions. These built-in functions
are the integral part of the smarty template engine. They are compiled
into corresponding inline PHP code for maximum performance.
You cannot create your own [custom functions](../language-custom-functions.md) with the same name; and you
should not need to modify the built-in functions.
A few of these functions have an `assign` attribute which collects the
result the function to a named template variable instead of being
output; much like the [`{assign}`](language-function-assign.md) function.
- [{append}](language-function-append.md)
- [{assign}](language-function-assign.md) or [{$var=...}](language-function-shortform-assign.md)
- [{block}](language-function-block.md)
- [{call}](language-function-call.md)
- [{capture}](language-function-capture.md)
- [{config_load}](language-function-config-load.md)
- [{debug}](language-function-debug.md)
- [{extends}](language-function-extends.md)
- [{for}](language-function-for.md)
- [{foreach}, {foreachelse}](language-function-foreach.md)
- [{function}](language-function-function.md)
- [{if}, {elseif}, {else}](language-function-if.md)
- [{include}](language-function-include.md)
- [{insert}](language-function-insert.md)
- [{ldelim}, {rdelim}](language-function-ldelim.md)
- [{literal}](language-function-literal.md)
- [{nocache}](language-function-nocache.md)
- [{section}, {sectionelse}](language-function-section.md)
- [{setfilter}](language-function-setfilter.md)
- [{strip}](language-function-strip.md)
- [{while}](language-function-while.md)

View File

@ -1,42 +1,42 @@
{append} {#language.function.append} # {append}
========
`{append}` is used for creating or appending template variable arrays `{append}` is used for creating or appending template variable arrays
**during the execution of a template**. **during the execution of a template**.
## Attributes
| Attribute | Required | Description |
|-----------|------------|----------------------------------------------------------------------------------------------------|
| var | | The name of the variable being assigned |
| value | | The value being assigned |
| index | (optional) | The index for the new array element. If not specified the value is append to the end of the array. |
| scope | (optional) | The scope of the assigned variable: parent, root or global. Defaults to local if omitted. |
## Option Flags
| Name | Description |
|---------|-----------------------------------------------------|
| nocache | Assigns the variable with the 'nocache' attribute |
> **Note** > **Note**
> >
> Assignment of variables in-template is essentially placing application > Assignment of variables in-template is essentially placing application
> logic into the presentation that may be better handled in PHP. Use at > logic into the presentation that may be better handled in PHP. Use at
> your own discretion. > your own discretion.
**Attributes:** ## Examples
Attribute Name Type Required Default Description ```smarty
---------------- -------- ---------- --------- ---------------------------------------------------------------------------------------------------- {append var='name' value='Bob' index='first'}
var string Yes *n/a* The name of the variable being assigned {append var='name' value='Meyer' index='last'}
value string Yes *n/a* The value being assigned // or
index string No *n/a* The index for the new array element. If not specified the value is append to the end of the array. {append 'name' 'Bob' index='first'} {* short-hand *}
scope string No *n/a* The scope of the assigned variable: \'parent\',\'root\' or \'global\' {append 'name' 'Meyer' index='last'} {* short-hand *}
**Option Flags:**
Name Description
--------- -----------------------------------------------------
nocache Assigns the variable with the \'nocache\' attribute
{append var='name' value='Bob' index='first'}
{append var='name' value='Meyer' index='last'}
// or
{append 'name' 'Bob' index='first'} {* short-hand *}
{append 'name' 'Meyer' index='last'} {* short-hand *}
The first name is {$name.first}.<br>
The last name is {$name.last}.
The first name is {$name.first}.<br>
The last name is {$name.last}.
```
The above example will output: The above example will output:

View File

@ -1,148 +1,147 @@
{assign} {#language.function.assign} # {assign}, {$var=...}
========
`{assign}` is used for assigning template variables **during the `{assign}` or `{$var=...}` is used for assigning template variables **during the
execution of a template**. execution of a template**.
## Attributes of the {assign} syntax
| Attribute Name | Required | Description |
|----------------|------------|-----------------------------------------------------------------------|
| var | | The name of the variable being assigned |
| value | | The value being assigned |
| scope | (optional) | The scope of the assigned variable: \'parent\',\'root\' or \'global\' |
## Attributes of the {$var=...} syntax
| Attribute Name | Required | Description |
|----------------|------------|-----------------------------------------------------------------------|
| scope | (optional) | The scope of the assigned variable: \'parent\',\'root\' or \'global\' |
## Option Flags
| Name | Description |
|---------|---------------------------------------------------|
| nocache | Assigns the variable with the 'nocache' attribute |
> **Note** > **Note**
> >
> Assignment of variables in-template is essentially placing application > Assignment of variables in-template is essentially placing application
> logic into the presentation that may be better handled in PHP. Use at > logic into the presentation that may be better handled in PHP. Use at
> your own discretion. > your own discretion.
> **Note** ## Examples
>
> See also the [`short-form`](#language.function.shortform.assign)
> method of assigning template vars.
**Attributes:** ```smarty
{assign var="name" value="Bob"} {* or *}
Attribute Name Type Required Default Description {assign "name" "Bob"} {* short-hand, or *}
---------------- -------- ---------- --------- ----------------------------------------------------------------------- {$name='Bob'}
var string Yes *n/a* The name of the variable being assigned
value string Yes *n/a* The value being assigned
scope string No *n/a* The scope of the assigned variable: \'parent\',\'root\' or \'global\'
**Option Flags:**
Name Description
--------- -----------------------------------------------------
nocache Assigns the variable with the \'nocache\' attribute
{assign var="name" value="Bob"}
{assign "name" "Bob"} {* short-hand *}
The value of $name is {$name}.
The value of $name is {$name}.
```
The above example will output: The above example will output:
```
The value of $name is Bob. The value of $name is Bob.
```
{assign var="name" value="Bob" nocache} ```smarty
{assign "name" "Bob" nocache} {* short-hand *} {assign var="name" value="Bob" nocache} {* or *}
{assign "name" "Bob" nocache} {* short-hand, or *}
The value of $name is {$name}. {$name='Bob' nocache}
The value of $name is {$name}.
```
The above example will output: The above example will output:
```
The value of $name is Bob.
The value of $name is Bob. ```
```smarty
{assign var=running_total value=$running_total+$some_array[$row].some_value} {assign var=running_total value=$running_total+$some_array[$row].some_value} {* or *}
{$running_total=$running_total+$some_array[row].some_value}
```
Variables assigned in the included template will be seen in the Variables assigned in the included template will be seen in the
including template. including template.
```smarty
{include file="sub_template.tpl"}
{include file="sub_template.tpl"} {* display variable assigned in sub_template *}
... {$foo}<br>
{* display variable assigned in sub_template *} ```
{$foo}<br>
...
The template above includes the example `sub_template.tpl` below:
The template above includes the example `sub_template.tpl` below ```smarty
{* foo will be known also in the including template *}
{assign var="foo" value="something" scope=parent}
{$foo="something" scope=parent}
... {* bar is assigned only local in the including template *}
{* foo will be known also in the including template *} {assign var="bar" value="value"} {* or *}
{assign var="foo" value="something" scope=parent} {$var="value"}
{* bar is assigned only local in the including template *}
{assign var="bar" value="value"} ```
...
You can assign a variable to root of the current root tree. The variable You can assign a variable to root of the current root tree. The variable
is seen by all templates using the same root tree. is seen by all templates using the same root tree.
```smarty
{assign var=foo value="bar" scope="root"} {assign var=foo value="bar" scope="root"}
```
A global variable is seen by all templates. A global variable is seen by all templates.
```smarty
{assign var=foo value="bar" scope="global"} {assign var=foo value="bar" scope="global"} {* or *}
{assign "foo" "bar" scope="global"} {* short-hand *} {assign "foo" "bar" scope="global"} {* short-hand, or *}
{$foo="bar" scope="global"}
```
To access `{assign}` variables from a php script use To access `{assign}` variables from a php script use
[`getTemplateVars()`](#api.get.template.vars). Here\'s the template that [`getTemplateVars()`](../../programmers/api-functions/api-get-template-vars.md).
creates the variable `$foo`. Here's the template that creates the variable `$foo`.
```smarty
{assign var="foo" value="Smarty"} {assign var="foo" value="Smarty"} {* or *}
{$foo="Smarty"}
```
The template variables are only available after/during template The template variables are only available after/during template
execution as in the following script. execution as in the following script.
```php
<?php
<?php // this will output nothing as the template has not been executed
echo $smarty->getTemplateVars('foo');
// this will output nothing as the template has not been executed // fetch the template to a variable
echo $smarty->getTemplateVars('foo'); $whole_page = $smarty->fetch('index.tpl');
// fetch the template to a variable // this will output 'smarty' as the template has been executed
$whole_page = $smarty->fetch('index.tpl'); echo $smarty->getTemplateVars('foo');
// this will output 'smarty' as the template has been executed $smarty->assign('foo','Even smarter');
echo $smarty->getTemplateVars('foo');
$smarty->assign('foo','Even smarter'); // this will output 'Even smarter'
echo $smarty->getTemplateVars('foo');
```
// this will output 'Even smarter' The following functions can also *optionally* assign template variables: [`{capture}`](#language.function.capture),
echo $smarty->getTemplateVars('foo');
?>
The following functions can also *optionally* assign template variables.
[`{capture}`](#language.function.capture),
[`{include}`](#language.function.include), [`{include}`](#language.function.include),
[`{insert}`](#language.function.insert), [`{insert}`](#language.function.insert),
[`{counter}`](#language.function.counter), [`{counter}`](#language.function.counter),
[`{cycle}`](#language.function.cycle), [`{cycle}`](#language.function.cycle),
[`{eval}`](#language.function.eval), [`{eval}`](#language.function.eval),
[`{fetch}`](#language.function.fetch), [`{fetch}`](#language.function.fetch),
[`{math}`](#language.function.math), [`{math}`](#language.function.math) and
[`{textformat}`](#language.function.textformat) [`{textformat}`](#language.function.textformat).
See also [`{$var=...}`](#language.function.shortform.assign), See also [`{append}`](./language-function-append.md),
[`assign()`](#api.assign) and [`assign()`](#api.assign) and
[`getTemplateVars()`](#api.get.template.vars). [`getTemplateVars()`](#api.get.template.vars).

View File

@ -1,9 +1,8 @@
{block} {#language.function.block} # {block}
=======
`{block}` is used to define a named area of template source for template `{block}` is used to define a named area of template source for template
inheritance. For details see section of [Template inheritance. For details see section of [Template
Inheritance](#advanced.features.template.inheritance). Inheritance](../../programmers/advanced-features/advanced-features-template-inheritance.md).
The `{block}` template source area of a child template will replace the The `{block}` template source area of a child template will replace the
corresponding areas in the parent template(s). corresponding areas in the parent template(s).
@ -11,181 +10,192 @@ corresponding areas in the parent template(s).
Optionally `{block}` areas of child and parent templates can be merged Optionally `{block}` areas of child and parent templates can be merged
into each other. You can append or prepend the parent `{block}` content into each other. You can append or prepend the parent `{block}` content
by using the `append` or `prepend` option flag with the child's `{block}` by using the `append` or `prepend` option flag with the child's `{block}`
definition. With the {\$smarty.block.parent} the `{block}` content of definition. With `{$smarty.block.parent}` the `{block}` content of
the parent template can be inserted at any location of the child the parent template can be inserted at any location of the child
`{block}` content. {\$smarty.block.child} inserts the `{block}` content `{block}` content. `{$smarty.block.child}` inserts the `{block}` content
of the child template at any location of the parent `{block}`. of the child template at any location of the parent `{block}`.
`{blocks}'s` can be nested. `{blocks}'s` can be nested.
**Attributes:** ## Attributes
Attribute Name Type Required Default Description | Attribute Name | Required | Description |
---------------- -------- ---------- --------- --------------------------------------- |----------------|----------|----------------------------------------------------------------------------------------------------------------------|
name string Yes *n/a* The name of the template source block | name | yes | The name of the template source block |
| assign | no | The name of variable to assign the output of the block to. |
**Option Flags (in child templates only):** > **Note**
>
> The assign attribute only works on the block that actually gets executed, so you may need
> to add it to each child block as well.
Name Description
--------- ------------------------------------------------------------------------------------------- ## Option Flags (in child templates only):
append The `{block}` content will be be appended to the content of the parent template `{block}`
prepend The `{block}` content will be prepended to the content of the parent template `{block}` | Name | Description |
hide Ignore the block content if no child block of same name is existing. |---------|-----------------------------------------------------------------------------------------|
nocache Disables caching of the `{block}` content | append | The `{block}` content will be appended to the content of the parent template `{block}` |
| prepend | The `{block}` content will be prepended to the content of the parent template `{block}` |
| hide | Ignore the block content if no child block of same name is existing. |
| nocache | Disables caching of the `{block}` content |
## Examples
parent.tpl parent.tpl
```smarty
<html> <html>
<head> <head>
<title>{block name="title"}Default Title{/block}</title> <title>{block name="title"}Default Title{/block}</title>
<title>{block "title"}Default Title{/block}</title> {* short-hand *} <title>{block "title"}Default Title{/block}</title> {* short-hand *}
</head> </head>
</html> </html>
```
child.tpl child.tpl
```smarty
{extends file="parent.tpl"} {extends file="parent.tpl"}
{block name="title"} {block name="title"}
Page Title Page Title
{/block} {/block}
```
The result would look like The result would look like
```html
<html> <html>
<head> <head>
<title>Page Title</title> <title>Page Title</title>
</head> </head>
</html> </html>
```
parent.tpl parent.tpl
```smarty
<html> <html>
<head> <head>
<title>{block name="title"}Title - {/block}</title> <title>{block name="title"}Title - {/block}</title>
</head> </head>
</html> </html>
```
child.tpl child.tpl
```smarty
{extends file="parent.tpl"} {extends file="parent.tpl"}
{block name="title" append} {block name="title" append}
Page Title Page Title
{/block} {/block}
```
The result would look like The result would look like
```html
<html> <html>
<head> <head>
<title>Title - Page Title</title> <title>Title - Page Title</title>
</head> </head>
</html> </html>
```
parent.tpl parent.tpl
```smarty
<html> <html>
<head> <head>
<title>{block name="title"} is my title{/block}</title> <title>{block name="title"} is my title{/block}</title>
</head> </head>
</html> </html>
```
child.tpl child.tpl
```smarty
{extends file="parent.tpl"} {extends file="parent.tpl"}
{block name="title" prepend} {block name="title" prepend}
Page Title Page Title
{/block} {/block}
```
The result would look like The result would look like
```html
<html> <html>
<head> <head>
<title>Page title is my titel</title> <title>Page title is my titel</title>
</head> </head>
</html> </html>
```
parent.tpl parent.tpl
```smarty
<html> <html>
<head> <head>
<title>{block name="title"}The {$smarty.block.child} was inserted here{/block}</title> <title>{block name="title"}The {$smarty.block.child} was inserted here{/block}</title>
</head> </head>
</html> </html>
```
child.tpl child.tpl
```smarty
{extends file="parent.tpl"} {extends file="parent.tpl"}
{block name="title"} {block name="title"}
Child Title Child Title
{/block} {/block}
```
The result would look like The result would look like
```html
<html> <html>
<head> <head>
<title>The Child Title was inserted here</title> <title>The Child Title was inserted here</title>
</head> </head>
</html> </html>
```
parent.tpl parent.tpl
```smarty
<html> <html>
<head> <head>
<title>{block name="title"}Parent Title{/block}</title> <title>{block name="title"}Parent Title{/block}</title>
</head> </head>
</html> </html>
```
child.tpl child.tpl
```smarty
{extends file="parent.tpl"} {extends file="parent.tpl"}
{block name="title"} {block name="title"}
You will see now - {$smarty.block.parent} - here You will see now - {$smarty.block.parent} - here
{/block} {/block}
```
The result would look like The result would look like
```html
<html> <html>
<head> <head>
<title>You will see now - Parent Title - here</title> <title>You will see now - Parent Title - here</title>
</head> </head>
</html> </html>
```
See also [Template See also [Template
Inheritance](#advanced.features.template.inheritance), Inheritance](../../programmers/advanced-features/advanced-features-template-inheritance.md),
[`$smarty.block.parent`](#language.variables.smarty.block.parent), [`$smarty.block.parent`](../language-variables/language-variables-smarty.md#smartyblockparent-languagevariablessmartyblockparent),
[`$smarty.block.child`](#language.variables.smarty.block.child), and [`$smarty.block.child`](../language-variables/language-variables-smarty.md#smartyblockchild-languagevariablessmartyblockchild), and
[`{extends}`](#language.function.extends) [`{extends}`](./language-function-extends.md)

View File

@ -1,39 +1,41 @@
{call} {#language.function.call} # {call}
======
`{call}` is used to call a template function defined by the `{call}` is used to call a template function defined by the
[`{function}`](#language.function.function) tag just like a plugin [`{function}`](./language-function-function.md) tag just like a plugin
function. function.
> **Note** > **Note**
> >
> Template functions are defined global. Since the Smarty compiler is a > Template functions are defined global. Since the Smarty compiler is a
> single-pass compiler, The [`{call}`](#language.function.call) tag must > single-pass compiler, The `{call}` tag must
> be used to call a template function defined externally from the given > be used to call a template function defined externally from the given
> template. Otherwise you can directly use the function as > template. Otherwise you can directly use the function as
> `{funcname ...}` in the template. > `{funcname ...}` in the template.
- The `{call}` tag must have the `name` attribute which contains the - The `{call}` tag must have the `name` attribute which contains the
the name of the template function. name of the template function.
- Values for variables can be passed to the template function as - Values for variables can be passed to the template function as
[attributes](#language.syntax.attributes). [attributes](../language-basic-syntax/language-syntax-attributes.md).
**Attributes:** ## Attributes
Attribute Name Type Required Default Description | Attribute Name | Required | Description |
---------------- -------------- ---------- --------- ------------------------------------------------------------------------------------------ |----------------|----------|------------------------------------------------------------------------------------------|
name string Yes *n/a* The name of the template function | name | Yes | The name of the template function |
assign string No *n/a* The name of the variable that the output of called template function will be assigned to | assign | No | The name of the variable that the output of called template function will be assigned to |
\[var \...\] \[var type\] No *n/a* variable to pass local to template function | [var ...] | No | variable to pass local to template function |
**Option Flags:** ## Option Flags
Name Description | Name | Description |
--------- -------------------------------------------- |---------|--------------------------------------------|
nocache Call the template function in nocache mode | nocache | Call the template function in nocache mode |
## Examples
```smarty
{* define the function *} {* define the function *}
{function name=menu level=0} {function name=menu level=0}
<ul class="level{$level}"> <ul class="level{$level}">
@ -55,12 +57,12 @@ function.
{* run the array through the function *} {* run the array through the function *}
{call name=menu data=$menu} {call name=menu data=$menu}
{call menu data=$menu} {* short-hand *} {call menu data=$menu} {* short-hand *}
```
Will generate the following output Will generate the following output
```
* item1 * item1
* item2 * item2
* item3 * item3
@ -70,7 +72,6 @@ Will generate the following output
+ item3-3-1 + item3-3-1
+ item3-3-2 + item3-3-2
* item4 * item4
```
See also [`{function}`](./language-function-function.md).
See also [`{function}`](#language.function.function)

View File

@ -1,5 +1,4 @@
{capture} {#language.function.capture} # {capture}
=========
`{capture}` is used to collect the output of the template between the `{capture}` is used to collect the output of the template between the
tags into a variable instead of displaying it. Any content between tags into a variable instead of displaying it. Any content between
@ -7,26 +6,26 @@ tags into a variable instead of displaying it. Any content between
specified in the `name` attribute. specified in the `name` attribute.
The captured content can be used in the template from the variable The captured content can be used in the template from the variable
[`$smarty.capture.foo`](#language.variables.smarty.capture) where "foo" [`$smarty.capture.foo`](../language-variables/language-variables-smarty.md#smartycapture-languagevariablessmartycapture) where "foo"
is the value passed in the `name` attribute. If you do not supply the is the value passed in the `name` attribute. If you do not supply the
`name` attribute, then "default" will be used as the name ie `name` attribute, then "default" will be used as the name ie
`$smarty.capture.default`. `$smarty.capture.default`.
`{capture}'s` can be nested. `{capture}'s` can be nested.
**Attributes:** ## Attributes
Attribute Name Type Required Default Description | Attribute Name | Required | Description |
---------------- -------- ---------- --------- ---------------------------------------------------------------------- |----------------|----------|----------------------------------------------------------------------|
name string Yes *n/a* The name of the captured block | name | Yes | The name of the captured block |
assign string No *n/a* The variable name where to assign the captured output to | assign | No | The variable name where to assign the captured output to |
append string No *n/a* The name of an array variable where to append the captured output to | append | No | The name of an array variable where to append the captured output to |
**Option Flags:** ## Option Flags
Name Description | Name | Description |
--------- ----------------------------------------- |---------|-----------------------------------------|
nocache Disables caching of this captured block | nocache | Disables caching of this captured block |
> **Note** > **Note**
> >
@ -35,48 +34,48 @@ is the value passed in the `name` attribute. If you do not supply the
> [`{insert}`](#language.function.insert) commands that you expect to > [`{insert}`](#language.function.insert) commands that you expect to
> run within cached content, do not capture this content. > run within cached content, do not capture this content.
## Examples
{* we don't want to print a div tag unless content is displayed *} ```smarty
{capture name="banner"} {* we don't want to print a div tag unless content is displayed *}
{capture "banner"} {* short-hand *} {capture name="banner"}
{include file="get_banner.tpl"} {capture "banner"} {* short-hand *}
{/capture} {include file="get_banner.tpl"}
{/capture}
{if $smarty.capture.banner ne ""}
<div id="banner">{$smarty.capture.banner}</div>
{/if}
{if $smarty.capture.banner ne ""}
<div id="banner">{$smarty.capture.banner}</div>
{/if}
```
This example demonstrates the capture function. This example demonstrates the capture function.
```smarty
{capture name=some_content assign=popText}
{capture name=some_content assign=popText} {capture some_content assign=popText} {* short-hand *}
{capture some_content assign=popText} {* short-hand *} The server is {$my_server_name|upper} at {$my_server_addr}<br>
The server is {$my_server_name|upper} at {$my_server_addr}<br> Your ip is {$my_ip}.
Your ip is {$my_ip}. {/capture}
{/capture} <a href="#">{$popText}</a>
<a href="#">{$popText}</a> ```
This example also demonstrates how multiple calls of capture can be used This example also demonstrates how multiple calls of capture can be used
to create an array with captured content. to create an array with captured content.
```smarty
{capture append="foo"}hello{/capture}I say just {capture append="foo"}world{/capture} {capture append="foo"}hello{/capture}I say just {capture append="foo"}world{/capture}
{foreach $foo as $text}{$text} {/foreach} {foreach $foo as $text}{$text} {/foreach}
```
The above example will output: The above example will output:
```
I say just hello world I say just hello world
```
See also [`$smarty.capture`](#language.variables.smarty.capture), See also [`$smarty.capture`](../language-variables/language-variables-smarty.md#smartycapture-languagevariablessmartycapture),
[`{eval}`](#language.function.eval), [`{eval}`](./language-function-eval.md),
[`{fetch}`](#language.function.fetch), [`fetch()`](#api.fetch) and [`{fetch}`](./language-function-fetch.md), [`fetch()`](../../programmers/api-functions/api-fetch.md) and
[`{assign}`](#language.function.assign). [`{assign}`](./language-function-assign.md).

View File

@ -1,56 +1,52 @@
{config\_load} {#language.function.config.load} # {config_load}
==============
`{config_load}` is used for loading config `{config_load}` is used for loading config
[`#variables#`](#language.config.variables) from a [configuration [`#variables#`](#language.config.variables) from a [configuration file](#config.files) into the template.
file](#config.files) into the template.
**Attributes:** ## Attributes
Attribute Name Type Required Default Description | Attribute Name | Required | Description |
---------------- -------- ---------- --------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |----------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
file string Yes *n/a* The name of the config file to include | file | Yes | The name of the config file to include |
section string No *n/a* The name of the section to load | section | No | The name of the section to load |
scope string no *local* How the scope of the loaded variables are treated, which must be one of local, parent or global. local means variables are loaded into the local template context. parent means variables are loaded into both the local context and the parent template that called it. global means variables are available to all templates. | scope | no | How the scope of the loaded variables are treated, which must be one of local, parent or global. local means variables are loaded into the local template context. parent means variables are loaded into both the local context and the parent template that called it. global means variables are available to all templates. |
The `example.conf` file. The `example.conf` file.
```ini
#this is config file comment
#this is config file comment # global variables
pageTitle = "Main Menu"
# global variables bodyBgColor = #000000
pageTitle = "Main Menu" tableBgColor = #000000
bodyBgColor = #000000 rowBgColor = #00ff00
tableBgColor = #000000
rowBgColor = #00ff00
#customer variables section
[Customer]
pageTitle = "Customer Info"
#customer variables section
[Customer]
pageTitle = "Customer Info"
```
and the template and the template
```smarty
{config_load file="example.conf"}
{config_load "example.conf"} {* short-hand *}
{config_load file="example.conf"} <html>
{config_load "example.conf"} {* short-hand *}
<html>
<title>{#pageTitle#|default:"No title"}</title> <title>{#pageTitle#|default:"No title"}</title>
<body bgcolor="{#bodyBgColor#}"> <body bgcolor="{#bodyBgColor#}">
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}"> <table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
<tr bgcolor="{#rowBgColor#}"> <tr bgcolor="{#rowBgColor#}">
<td>First</td> <td>First</td>
<td>Last</td> <td>Last</td>
<td>Address</td> <td>Address</td>
</tr> </tr>
</table> </table>
</body> </body>
</html> </html>
```
[Config Files](#config.files) may also contain sections. You can load [Config Files](#config.files) may also contain sections. You can load
variables from within a section with the added attribute `section`. Note variables from within a section with the added attribute `section`. Note
that global config variables are always loaded along with section that global config variables are always loaded along with section
@ -59,33 +55,31 @@ variables, and same-named section variables overwrite the globals.
> **Note** > **Note**
> >
> Config file *sections* and the built-in template function called > Config file *sections* and the built-in template function called
> [`{section}`](#language.function.section) have nothing to do with each > [`{section}`](../language-builtin-functions/language-function-section.md) have nothing to do with each
> other, they just happen to share a common naming convention. > other, they just happen to share a common naming convention.
```smarty
{config_load file='example.conf' section='Customer'}
{config_load 'example.conf' 'Customer'} {* short-hand *}
{config_load file='example.conf' section='Customer'} <html>
{config_load 'example.conf' 'Customer'} {* short-hand *}
<html>
<title>{#pageTitle#}</title> <title>{#pageTitle#}</title>
<body bgcolor="{#bodyBgColor#}"> <body bgcolor="{#bodyBgColor#}">
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}"> <table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
<tr bgcolor="{#rowBgColor#}"> <tr bgcolor="{#rowBgColor#}">
<td>First</td> <td>First</td>
<td>Last</td> <td>Last</td>
<td>Address</td> <td>Address</td>
</tr> </tr>
</table> </table>
</body> </body>
</html> </html>
```
See [`$config_overwrite`](../../programmers/api-variables/variable-config-overwrite.md) to create arrays
See [`$config_overwrite`](#variable.config.overwrite) to create arrays
of config file variables. of config file variables.
See also the [config files](#config.files) page, [config See also the [config files](../config-files.md) page, [config variables](../language-variables/language-config-variables.md) page,
variables](#language.config.variables) page, [`$config_dir`](../../programmers/api-variables/variable-config-dir.md),
[`$config_dir`](#variable.config.dir), [`getConfigVars()`](../../programmers/api-functions/api-get-config-vars.md) and
[`getConfigVars()`](#api.get.config.vars) and [`configLoad()`](../../programmers/api-functions/api-config-load.md).
[`configLoad()`](#api.config.load).

View File

@ -1,10 +1,9 @@
{debug} {#language.function.debug} # {debug}
=======
`{debug}` dumps the debug console to the page. This works regardless of `{debug}` dumps the debug console to the page. This works regardless of
the [debug](#chapter.debugging.console) settings in the php script. the [debug](../chapter-debugging-console.md) settings in the php script.
Since this gets executed at runtime, this is only able to show the Since this gets executed at runtime, this is only able to show the
[assigned](#api.assign) variables; not the templates that are in use. [assigned](../../programmers/api-functions/api-assign.md) variables; not the templates that are in use.
However, you can see all the currently available variables within the However, you can see all the currently available variables within the
scope of a template. scope of a template.
@ -15,4 +14,4 @@ In order to see also the variables which have been locally assigned
within the template it does make sense to place the `{debug}` tag at the within the template it does make sense to place the `{debug}` tag at the
end of the template. end of the template.
See also the [debugging console page](#chapter.debugging.console). See also the [debugging console page](../chapter-debugging-console.md).

View File

@ -1,9 +1,8 @@
{extends} {#language.function.extends} # {extends}
=========
`{extends}` tags are used in child templates in template inheritance for `{extends}` tags are used in child templates in template inheritance for
extending parent templates. For details see section of [Template extending parent templates. For details see section of [Template
Inheritance](#advanced.features.template.inheritance). Inheritance](../../programmers/advanced-features/advanced-features-template-inheritance.md).
- The `{extends}` tag must be on the first line of the template. - The `{extends}` tag must be on the first line of the template.
@ -11,27 +10,26 @@ Inheritance](#advanced.features.template.inheritance).
tag it may contain only `{block}` tags. Any other template content tag it may contain only `{block}` tags. Any other template content
is ignored. is ignored.
- Use the syntax for [template resources](#resources) to extend files - Use the syntax for [template resources](../../programmers/resources.md) to extend files
outside of the [`$template_dir`](#variable.template.dir) directory. outside the [`$template_dir`](../../programmers/api-variables/variable-template-dir.md) directory.
## Attributes
| Attribute | Required | Description |
|-----------|----------|-------------------------------------------------|
| file | Yes | The name of the template file which is extended |
> **Note** > **Note**
> >
> When extending a variable parent like `{extends file=$parent_file}`, > When extending a variable parent like `{extends file=$parent_file}`,
> make sure you include `$parent_file` in the > make sure you include `$parent_file` in the
> [`$compile_id`](#variable.compile.id). Otherwise Smarty cannot > [`$compile_id`](../../programmers/api-variables/variable-compile-id.md). Otherwise, Smarty cannot
> distinguish between different `$parent_file`s. > distinguish between different `$parent_file`s.
**Attributes:** ```smarty
{extends file='parent.tpl'}
{extends 'parent.tpl'} {* short-hand *}
```
Attribute Name Type Required Default Description See also [Template Inheritance](../../programmers/advanced-features/advanced-features-template-inheritance.md)
---------------- -------- ---------- --------- ------------------------------------------------- and [`{block}`](./language-function-block.md).
file string Yes *n/a* The name of the template file which is extended
{extends file='parent.tpl'}
{extends 'parent.tpl'} {* short-hand *}
See also [Template Inheritance](#advanced.features.template.inheritance)
and [`{block}`](#language.function.block).

View File

@ -1,84 +0,0 @@
{\$var=\...} {#language.function.shortform.assign}
============
This is a short-hand version of the {assign} function. You can assign
values directly to the template, or assign values to array elements too.
> **Note**
>
> Assignment of variables in-template is essentially placing application
> logic into the presentation that may be better handled in PHP. Use at
> your own discretion.
The following attributes can be added to the tag:
**Attributes:**
Attribute Name Shorthand Type Required Default Description
---------------- ----------- -------- ---------- --------- -----------------------------------------------------------------------
scope n/a string No *n/a* The scope of the assigned variable: \'parent\',\'root\' or \'global\'
**Option Flags:**
Name Description
--------- -----------------------------------------------------
nocache Assigns the variable with the \'nocache\' attribute
{$name='Bob'}
The value of $name is {$name}.
The above example will output:
The value of $name is Bob.
{$running_total=$running_total+$some_array[row].some_value}
{$user.name="Bob"}
{$user.name.first="Bob"}
{$users[]="Bob"}
Variables assigned in the included template will be seen in the
including template.
{include file="sub_template.tpl"}
...
{* display variable assigned in sub_template *}
{$foo}<br>
...
The template above includes the example `sub_template.tpl` below
...
{* foo will be known also in the including template *}
{$foo="something" scope=parent}
{* bar is assigned only local in the including template *}
{$bar="value"}
...
See also [`{assign}`](#language.function.assign) and
[`{append}`](#language.function.append)

View File

@ -1,35 +1,32 @@
Combining Modifiers {#language.combining.modifiers} # Combining Modifiers
===================
You can apply any number of modifiers to a variable. They will be You can apply any number of modifiers to a variable. They will be
applied in the order they are combined, from left to right. They must be applied in the order they are combined, from left to right. They must be
separated with a `|` (pipe) character. separated with a `|` (pipe) character.
```php
<?php
<?php $smarty->assign('articleTitle', 'Smokers are Productive, but Death Cuts Efficiency.');
```
$smarty->assign('articleTitle', 'Smokers are Productive, but Death Cuts Efficiency.');
?>
where template is: where template is:
```smarty
{$articleTitle} {$articleTitle}
{$articleTitle|upper|spacify} {$articleTitle|upper|spacify}
{$articleTitle|lower|spacify|truncate} {$articleTitle|lower|spacify|truncate}
{$articleTitle|lower|truncate:30|spacify} {$articleTitle|lower|truncate:30|spacify}
{$articleTitle|lower|spacify|truncate:30:". . ."} {$articleTitle|lower|spacify|truncate:30:". . ."}
```
The above example will output: The above example will output:
```
Smokers are Productive, but Death Cuts Efficiency. Smokers are Productive, but Death Cuts Efficiency.
S M O K E R S A R ....snip.... H C U T S E F F I C I E N C Y . S M O K E R S A R ....snip.... H C U T S E F F I C I E N C Y .
s m o k e r s a r ....snip.... b u t d e a t h c u t s... s m o k e r s a r ....snip.... b u t d e a t h c u t s...
s m o k e r s a r e p r o d u c t i v e , b u t . . . s m o k e r s a r e p r o d u c t i v e , b u t . . .
s m o k e r s a r e p. . . s m o k e r s a r e p. . .
```

View File

@ -1,10 +1,8 @@
Custom Functions {#language.custom.functions} # Custom Functions
================
Smarty comes with several custom plugin functions that you can use in Smarty comes with several custom plugin functions that you can use in
the templates. the templates.
## Table of contents
- [{counter}](./language-custom-functions/language-function-counter.md) - [{counter}](./language-custom-functions/language-function-counter.md)
- [{cycle}](./language-custom-functions/language-function-cycle.md) - [{cycle}](./language-custom-functions/language-function-cycle.md)
- [{eval}](./language-custom-functions/language-function-eval.md) - [{eval}](./language-custom-functions/language-function-eval.md)

View File

@ -1,7 +1,15 @@
Variable Modifiers {#language.modifiers} # Variable Modifiers
==================
Variable modifiers can be applied to
[variables](./language-variables.md), [custom functions](./language-custom-functions.md)
or strings. To apply a modifier,
specify the value followed by a `|` (pipe) and the modifier name. A
modifier may accept additional parameters that affect its behavior.
These parameters follow the modifier name and are separated by a `:`
(colon). Also, *all php-functions can be used as modifiers implicitly*
(more below) and modifiers can be
[combined](./language-combining-modifiers.md).
## Table of contents
- [capitalize](./language-modifiers/language-modifier-capitalize.md) - [capitalize](./language-modifiers/language-modifier-capitalize.md)
- [cat](./language-modifiers/language-modifier-cat.md) - [cat](./language-modifiers/language-modifier-cat.md)
- [count_characters](./language-modifiers/language-modifier-count-characters.md) - [count_characters](./language-modifiers/language-modifier-count-characters.md)
@ -27,59 +35,50 @@ Variable Modifiers {#language.modifiers}
- [upper](./language-modifiers/language-modifier-upper.md) - [upper](./language-modifiers/language-modifier-upper.md)
- [wordwrap](./language-modifiers/language-modifier-wordwrap.md) - [wordwrap](./language-modifiers/language-modifier-wordwrap.md)
Variable modifiers can be applied to ## Examples
[variables](./language-variables.md), [custom
functions](./language-custom-functions.md) or strings. To apply a modifier,
specify the value followed by a `|` (pipe) and the modifier name. A
modifier may accept additional parameters that affect its behavior.
These parameters follow the modifier name and are separated by a `:`
(colon). Also, *all php-functions can be used as modifiers implicitly*
(more below) and modifiers can be
[combined](./language-combining-modifiers.md).
```smarty
{* apply modifier to a variable *}
{$title|upper}
{* apply modifier to a variable *} {* modifier with parameters *}
{$title|upper} {$title|truncate:40:"..."}
{* modifier with parameters *} {* apply modifier to a function parameter *}
{$title|truncate:40:"..."} {html_table loop=$myvar|upper}
{* apply modifier to a function parameter *} {* with parameters *}
{html_table loop=$myvar|upper} {html_table loop=$myvar|truncate:40:"..."}
{* with parameters *} {* apply modifier to literal string *}
{html_table loop=$myvar|truncate:40:"..."} {"foobar"|upper}
{* apply modifier to literal string *} {* using date_format to format the current date *}
{"foobar"|upper} {$smarty.now|date_format:"%Y/%m/%d"}
{* using date_format to format the current date *} {* apply modifier to a custom function *}
{$smarty.now|date_format:"%Y/%m/%d"} {mailto|upper address="smarty@example.com"}
{* apply modifier to a custom function *} {* using php's str_repeat *}
{mailto|upper address="smarty@example.com"} {"="|str_repeat:80}
{* using php's str_repeat *} {* php's count *}
{"="|str_repeat:80} {$myArray|@count}
{* php's count *}
{$myArray|@count}
{* this will uppercase and truncate the whole array *}
<select name="name_id">
{html_options output=$my_array|upper|truncate:20}
</select>
{* this will uppercase and truncate the whole array *}
<select name="name_id">
{html_options output=$my_array|upper|truncate:20}
</select>
```
- Modifiers can be applied to any type of variables, including arrays - Modifiers can be applied to any type of variables, including arrays
and objects. and objects.
> **Note** > **Note**
> >
> The default behavior was changed with Smarty 3. In Smarty 2.x, you > The default behavior was changed with Smarty 3. In Smarty 2.x, you
> had to use an \"`@`\" symbol to apply a modifier to an array, such > had to use an "`@`" symbol to apply a modifier to an array, such
> as `{$articleTitle|@count}`. With Smarty 3, the \"`@`\" is no > as `{$articleTitle|@count}`. With Smarty 3, the "`@`" is no
> longer necessary, and is ignored. > longer necessary, and is ignored.
> >
> If you want a modifier to apply to each individual item of an > If you want a modifier to apply to each individual item of an

View File

@ -1,16 +1,13 @@
Variables # Variables
=========
Smarty has several types of variables. The type of the
variable depends on what symbol it is prefixed or enclosed within.
## Table of contents
- [Variables assigned from PHP](./language-variables/language-assigned-variables.md) - [Variables assigned from PHP](./language-variables/language-assigned-variables.md)
- [Variable scopes](./language-variables/language-variable-scopes.md) - [Variable scopes](./language-variables/language-variable-scopes.md)
- [Variables loaded from config files](./language-variables/language-config-variables.md) - [Variables loaded from config files](./language-variables/language-config-variables.md)
- [{$smarty} reserved variable](./language-variables/language-variables-smarty.md) - [{$smarty} reserved variable](./language-variables/language-variables-smarty.md)
Smarty has several different types of variables. The type of the
variable depends on what symbol it is prefixed or enclosed within.
Variables in Smarty can be either displayed directly or used as Variables in Smarty can be either displayed directly or used as
arguments for [functions](./language-basic-syntax/language-syntax-functions.md), arguments for [functions](./language-basic-syntax/language-syntax-functions.md),
[attributes](./language-basic-syntax/language-syntax-attributes.md) and [attributes](./language-basic-syntax/language-syntax-attributes.md) and
@ -19,17 +16,16 @@ To print a variable, simply enclose it in the
[delimiters](../programmers/api-variables/variable-left-delimiter.md) so that it is the only thing [delimiters](../programmers/api-variables/variable-left-delimiter.md) so that it is the only thing
contained between them. contained between them.
```smarty
{$Name}
{$Name} {$product.part_no} <b>{$product.description}</b>
{$product.part_no} <b>{$product.description}</b> {$Contacts[row].Phone}
{$Contacts[row].Phone}
<body bgcolor="{#bgcolor#}">
<body bgcolor="{#bgcolor#}">
```
> **Note** > **Note**
> >
> An easy way to examine assigned Smarty variables is with the > An easy way to examine assigned Smarty variables is with the

View File

@ -1,26 +1,25 @@
What is Smarty? # Getting started
==============
## Requirements ## Requirements
Smarty can be run with PHP 7.1 to PHP 8.2. Smarty can be run with PHP 7.1 to PHP 8.2.
## Installation ## Installation
Smarty versions 3.1.11 or later can be installed with [Composer](https://getcomposer.org/). Smarty can be installed with [Composer](https://getcomposer.org/).
To get the latest stable version of Smarty use: To get the latest stable version of Smarty use:
```bash ```shell
composer require smarty/smarty composer require smarty/smarty
```` ```
To get the latest, unreleased version, use: To get the latest, unreleased version, use:
```bash ```shell
composer require smarty/smarty:dev-master composer require smarty/smarty:dev-master
```` ```
To get the previous stable version of Smarty, Smarty 3, use: To get the previous stable version of Smarty, Smarty 3, use:
```bash ```shell
composer require smarty/smarty:^3 composer require smarty/smarty:^3
```` ```
Here's how you create an instance of Smarty in your PHP scripts: Here's how you create an instance of Smarty in your PHP scripts:
```php ```php
@ -30,7 +29,7 @@ require 'vendor/autoload.php';
$smarty = new Smarty(); $smarty = new Smarty();
``` ```
Now that the library files are in place, it's time to setup the Smarty Now that the library files are in place, it's time to set up the Smarty
directories for your application. directories for your application.
Smarty requires four directories which are by default named Smarty requires four directories which are by default named
@ -82,7 +81,7 @@ $smarty->testInstall();
Now, let's create the `index.tpl` file that Smarty will display. This Now, let's create the `index.tpl` file that Smarty will display. This
needs to be located in the [`$template_dir`](./programmers/api-variables/variable-template-dir.md). needs to be located in the [`$template_dir`](./programmers/api-variables/variable-template-dir.md).
```html ```smarty
{* Smarty *} {* Smarty *}
Hello {$name}, welcome to Smarty! Hello {$name}, welcome to Smarty!
``` ```
@ -118,24 +117,22 @@ $smarty->display('index.tpl');
> **Note** > **Note**
> >
> In our example, we are setting absolute paths to all of the Smarty > In our example, we are setting absolute paths to all the Smarty
> directories. If `/web/www.example.com/guestbook/` is within your PHP > directories. If `/web/www.example.com/guestbook/` is within your PHP
> include\_path, then these settings are not necessary. However, it is > include\_path, then these settings are not necessary. However, it is
> more efficient and (from experience) less error-prone to set them to > more efficient and (from experience) less error-prone to set them to
> absolute paths. This ensures that Smarty is getting files from the > absolute paths. This ensures that Smarty is getting files from the
> directories you intended. > directories you intended.
Now, run your PHP file. You should see *\"Hello Ned, welcome to Smarty!\"* Now, run your PHP file. You should see *"Hello Ned, welcome to Smarty!"*
You have completed the basic setup for Smarty! You have completed the basic setup for Smarty!
## Extended Setup {#installing.smarty.extended} ## Extended Setup
==============
This is a continuation of the [basic This is a continuation of the [basic installation](#installation), please read that first!
installation](#installing.smarty.basic), please read that first!
A slightly more flexible way to setup Smarty is to extend the Smarty A slightly more flexible way to set up Smarty is to extend the Smarty
class and initialize your Smarty class and initialize your Smarty
environment. So instead of repeatedly setting directory paths, assigning environment. So instead of repeatedly setting directory paths, assigning
the same vars, etc., we can do that in one place. the same vars, etc., we can do that in one place.
@ -163,7 +160,8 @@ class Smarty_GuestBook extends Smarty {
Now, we can use `Smarty_GuestBook` instead of `Smarty` in our scripts: Now, we can use `Smarty_GuestBook` instead of `Smarty` in our scripts:
```php ```php
<?php
$smarty = new Smarty_GuestBook(); $smarty = new Smarty_GuestBook();
$smarty->assign('name','Ned'); $smarty->assign('name', 'Ned');
$smarty->display('index.tpl'); $smarty->display('index.tpl');
``` ```

View File

@ -26,11 +26,11 @@ and 480 for $height, the result is:
- [Getting Started](./getting-started.md) - [Getting Started](./getting-started.md)
## Smarty for template designers ## Smarty for template designers
- [Basic Syntax](./designers/language-basic-syntax.md) - [Basic Syntax](designers/language-basic-syntax/language-basic-syntax.md)
- [Variables](./designers/language-variables.md) - [Variables](./designers/language-variables.md)
- [Variable Modifiers](./designers/language-modifiers.md) - [Variable Modifiers](./designers/language-modifiers.md)
- [Combining Modifiers](./designers/language-combining-modifiers.md) - [Combining Modifiers](./designers/language-combining-modifiers.md)
- [Built-in Functions](./designers/language-builtin-functions.md) - [Built-in Functions](designers/language-builtin-functions/language-builtin-functions.md)
- [Custom Functions](./designers/language-custom-functions.md) - [Custom Functions](./designers/language-custom-functions.md)
- [Config Files](./designers/config-files.md) - [Config Files](./designers/config-files.md)
- [Debugging Console](./designers/chapter-debugging-console.md) - [Debugging Console](./designers/chapter-debugging-console.md)

View File

@ -1,5 +1,4 @@
Philosophy # Philosophy
=======
## What is Smarty? ## What is Smarty?

View File

@ -5,6 +5,10 @@ theme:
primary: amber primary: amber
features: features:
- content.code.copy - content.code.copy
- navigation.tabs
- navigation.tabs.sticky
- navigation.instant
- navigation.tracking
icon: icon:
logo: material/lightbulb-on logo: material/lightbulb-on
favicon: images/favicon.ico favicon: images/favicon.ico
@ -19,3 +23,55 @@ markdown_extensions:
- pymdownx.inlinehilite - pymdownx.inlinehilite
- pymdownx.snippets - pymdownx.snippets
- pymdownx.superfences - pymdownx.superfences
nav:
- Home: 'index.md'
- 'Getting started': 'getting-started.md'
- 'Designers':
- 'Basic Syntax':
- Introduction: 'designers/language-basic-syntax/index.md'
- Comments: 'designers/language-basic-syntax/language-syntax-comments.md'
- Variables: 'designers/language-basic-syntax/language-syntax-variables.md'
- Functions: 'designers/language-basic-syntax/language-syntax-functions.md'
- Attributes: 'designers/language-basic-syntax/language-syntax-attributes.md'
- Quotes: 'designers/language-basic-syntax/language-syntax-quotes.md'
- Math: 'designers/language-basic-syntax/language-math.md'
- Escaping: 'designers/language-basic-syntax/language-escaping.md'
- 'designers/language-variables.md'
- 'designers/language-modifiers.md'
- 'designers/language-combining-modifiers.md'
- 'Builtin Functions':
- 'Introduction': 'designers/language-builtin-functions/index.md'
- '{append}': 'designers/language-builtin-functions/language-function-append.md'
- '{assign}': 'designers/language-builtin-functions/language-function-assign.md'
- '{block}': 'designers/language-builtin-functions/language-function-block.md'
- '{call}': 'designers/language-builtin-functions/language-function-call.md'
- '{capture}': 'designers/language-builtin-functions/language-function-capture.md'
- '{config_load}': 'designers/language-builtin-functions/language-function-config-load.md'
- '{debug}': 'designers/language-builtin-functions/language-function-debug.md'
- '{extends}': 'designers/language-builtin-functions/language-function-extends.md'
- '{for}': 'designers/language-builtin-functions/language-function-for.md'
- '{foreach}': 'designers/language-builtin-functions/language-function-foreach.md'
- '{function}': 'designers/language-builtin-functions/language-function-function.md'
- '{if},{elseif},{else}': 'designers/language-builtin-functions/language-function-if.md'
- '{include}': 'designers/language-builtin-functions/language-function-include.md'
- '{insert}': 'designers/language-builtin-functions/language-function-insert.md'
- '{ldelim},{rdelim}': 'designers/language-builtin-functions/language-function-ldelim.md'
- '{literal}': 'designers/language-builtin-functions/language-function-literal.md'
- '{nocache}': 'designers/language-builtin-functions/language-function-nocache.md'
- '{section}': 'designers/language-builtin-functions/language-function-section.md'
- '{setfilter}': 'designers/language-builtin-functions/language-function-setfilter.md'
- '{strip}': 'designers/language-builtin-functions/language-function-strip.md'
- '{while}': 'designers/language-builtin-functions/language-function-while.md'
- 'designers/language-custom-functions.md'
- 'designers/config-files.md'
- 'designers/chapter-debugging-console.md'
- 'Programmers':
- 'programmers/charset.md'
- 'programmers/smarty-constants.md'
- 'programmers/api-variables.md'
- 'programmers/api-functions.md'
- 'programmers/caching.md'
- 'programmers/resources.md'
- 'programmers/advanced-features.md'
- 'programmers/plugins.md'