- Finalizing the documentation before tagging 1.0 release
This commit is contained in:
1 parent
bb29a56077
commit
46535c2734
29 files changed
+933
-211
No files matched your search
@@ -0,0 +1,34 @@
|
||||
# Control structure - `Use`
|
||||
|
||||
While working with inside a template, it might be needed that you reference some other namespaces.
|
||||
|
||||
The use clause works exaclty like PHP's vanilla top of the page `use`.
|
||||
|
||||
**[PICEA]** So, using this code:
|
||||
|
||||
```html
|
||||
{% use AnyVendor\My\Super\Randomizer %}
|
||||
|
||||
{# One chance out of ten to end this loop %}
|
||||
{% while Randomizer::run(1, 10) === 10 %}
|
||||
{% if Randomizer::run(1, 100) < 50 %}
|
||||
<span>Lower than 50 !</span>
|
||||
{% else %}
|
||||
<strong>Greater than 50 !</strong>
|
||||
{% endif %}
|
||||
{% endwhile %}
|
||||
|
||||
<h4>DONE !</h4>
|
||||
```
|
||||
|
||||
**[HTML]** Could render as such output:
|
||||
|
||||
```html
|
||||
<span>Lower than 50 !</span>
|
||||
<span>Greater than 50 !</span>
|
||||
<span>Lower than 50 !</span>
|
||||
<span>Greater than 50 !</span>
|
||||
<span>Lower than 50 !</span>
|
||||
<span>Lower than 50 !</span>
|
||||
<h4>DONE !</h4>
|
||||
```
|
||||
Reference in new issue
Block a user