Skip to content

Commit f8857d7

Browse files
committed
Merge branch '6.1' into 6.2
2 parents e8a06fd + 935cd95 commit f8857d7

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

docs/view/template-plugins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ In some situations, `{assign}` is not sufficient to assign values to variables i
9494
Instead, `{capture}` can be used:
9595

9696
```smarty
97-
{capture var=templateVariable}
97+
{capture assign=templateVariable}
9898
{if $foo}
9999
<p>{$bar}</p>
100100
{else}

docs/view/templates.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ More examples:
250250

251251
### Foreach Loops
252252

253-
Foreach loops allow to iterate over arrays or iterable objects:
253+
Foreach loops allow to iterate over associative arrays or iterable objects:
254254

255255
```smarty
256256
<ul>
@@ -287,6 +287,39 @@ In contrast to PHP’s foreach loop, templates also support `foreachelse`:
287287
{/foreach}
288288
```
289289

290+
### Sections
291+
292+
Section loops allow iterations without the use associative arrays or iterable objects:
293+
294+
```smarty
295+
{section name=month start=1 loop=12}
296+
{$month}
297+
{/section}
298+
```
299+
300+
#### Parameters
301+
302+
| Name | Type | Required | Default | Description |
303+
|------|------|----------|---------|-------------|
304+
| name | string | Yes | n/a | The name of the section |
305+
| loop | mixed | Yes | n/a | Value to determine the number of loop iterations |
306+
| start | integer | No | 0 | The index position that the section will begin looping |
307+
| step | integer | No | 1 | The step value that will be used to traverse the loop array |
308+
| max | integer | No | n/a | The maximum number of times the section will loop |
309+
| show | boolean | No | true | Determines whether or not to show the section |
310+
311+
#### `{sectionelse}`
312+
313+
If the section loop does not perform any iterations, `{sectionelse}` can be defined for an alternative output:
314+
315+
```smarty
316+
{section name=name start=1 loop=$loop}
317+
318+
{sectionelse}
319+
there is nothing to iterate over
320+
{/section}
321+
```
322+
290323
### Including Other Templates
291324

292325
To include template named `foo` from the same domain (frontend/backend), you can use

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Markdown==3.7
1+
Markdown==3.8.2
22
mike==2.1.3
33
mkdocs-git-revision-date-plugin==0.3.2
44
mkdocs-macros-plugin==1.3.7
5-
mkdocs-material==9.5.49
5+
mkdocs-material==9.6.15
66
mkdocs==1.6.1
7-
setuptools==75.6.0
7+
setuptools==80.9.0

0 commit comments

Comments
 (0)