2023-02-03 22:27:18 +01:00
|
|
|
# Smarty Documentation
|
2021-12-03 11:59:22 +01:00
|
|
|
Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic.
|
|
|
|
|
2021-12-03 16:51:08 +01:00
|
|
|
It allows you to write **templates**, using **variables**, **modifiers**, **functions** and **comments**, like this:
|
2023-02-03 17:54:00 +01:00
|
|
|
```smarty
|
2021-12-03 16:51:08 +01:00
|
|
|
<h1>{$title|escape}</h1>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
The number of pixels is: {math equation="x * y" x=$height y=$width}.
|
|
|
|
</p>
|
|
|
|
```
|
|
|
|
|
|
|
|
When this template is rendered, with the value "Hello world" for the variable $title, 640 for $width,
|
|
|
|
and 480 for $height, the result is:
|
|
|
|
```html
|
|
|
|
<h1>Hello world</h1>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
The number of pixels is: 307200.
|
|
|
|
</p>
|
|
|
|
```
|
|
|
|
|
2023-03-09 23:16:18 +01:00
|
|
|
## Getting Started
|
|
|
|
- [Getting Started](./getting-started.md)
|
2021-12-03 16:51:08 +01:00
|
|
|
- [Philosophy](./philosophy.md) - or "Why do I need a template engine?"
|
|
|
|
- [Features](./features.md) - or "Why do I want Smarty?"
|
2021-12-03 12:18:46 +01:00
|
|
|
|
2023-03-09 23:16:18 +01:00
|
|
|
## Help
|
2021-12-03 16:51:08 +01:00
|
|
|
- [Some random tips & tricks](./appendixes/tips.md)
|
2021-12-03 12:18:46 +01:00
|
|
|
- [Troubleshooting](./appendixes/troubleshooting.md)
|