| 148 |
lars |
1 |
# Smarty 4 Documentation
|
|
|
2 |
Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic.
|
|
|
3 |
|
|
|
4 |
It allows you to write **templates**, using **variables**, **modifiers**, **functions** and **comments**, like this:
|
|
|
5 |
```html
|
|
|
6 |
<h1>{$title|escape}</h1>
|
|
|
7 |
|
|
|
8 |
<p>
|
|
|
9 |
The number of pixels is: {math equation="x * y" x=$height y=$width}.
|
|
|
10 |
</p>
|
|
|
11 |
```
|
|
|
12 |
|
|
|
13 |
When this template is rendered, with the value "Hello world" for the variable $title, 640 for $width,
|
|
|
14 |
and 480 for $height, the result is:
|
|
|
15 |
```html
|
|
|
16 |
<h1>Hello world</h1>
|
|
|
17 |
|
|
|
18 |
<p>
|
|
|
19 |
The number of pixels is: 307200.
|
|
|
20 |
</p>
|
|
|
21 |
```
|
|
|
22 |
|
|
|
23 |
## Introduction
|
|
|
24 |
- [Philosophy](./philosophy.md) - or "Why do I need a template engine?"
|
|
|
25 |
- [Features](./features.md) - or "Why do I want Smarty?"
|
|
|
26 |
- [Getting Started](./getting-started.md)
|
|
|
27 |
|
|
|
28 |
## Smarty for template designers
|
|
|
29 |
- [Basic Syntax](./designers/language-basic-syntax.md)
|
|
|
30 |
- [Variables](./designers/language-variables.md)
|
|
|
31 |
- [Variable Modifiers](./designers/language-modifiers.md)
|
|
|
32 |
- [Combining Modifiers](./designers/language-combining-modifiers.md)
|
|
|
33 |
- [Built-in Functions](./designers/language-builtin-functions.md)
|
|
|
34 |
- [Custom Functions](./designers/language-custom-functions.md)
|
|
|
35 |
- [Config Files](./designers/config-files.md)
|
|
|
36 |
- [Debugging Console](./designers/chapter-debugging-console.md)
|
|
|
37 |
|
|
|
38 |
## Smarty for php developers
|
|
|
39 |
- [Charset Encoding](./programmers/charset.md)
|
|
|
40 |
- [Constants](./programmers/smarty-constants.md)
|
|
|
41 |
- [Smarty Class Variables](./programmers/api-variables.md)
|
|
|
42 |
- [Smarty Class Methods](./programmers/api-functions.md)
|
|
|
43 |
- [Caching](./programmers/caching.md)
|
|
|
44 |
- [Resources](./programmers/resources.md)
|
|
|
45 |
- [Advanced Features](./programmers/advanced-features.md)
|
|
|
46 |
- [Extending Smarty With Plugins](./programmers/plugins.md)
|
|
|
47 |
|
|
|
48 |
## Other
|
|
|
49 |
- [Some random tips & tricks](./appendixes/tips.md)
|
|
|
50 |
- [Troubleshooting](./appendixes/troubleshooting.md)
|