Linux server.kiran-academy.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
: 194.233.91.196 | : 216.73.216.216
Cant Read [ /etc/named.conf ]
7.4.32
finalho
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
local /
cwpsrv /
var /
services /
twig /
doc /
tags /
[ HOME SHELL ]
Name
Size
Permission
Action
autoescape.rst
1.65
KB
-rw-r--r--
block.rst
448
B
-rw-r--r--
do.rst
177
B
-rw-r--r--
embed.rst
6.84
KB
-rw-r--r--
extends.rst
7.19
KB
-rw-r--r--
filter.rst
463
B
-rw-r--r--
flush.rst
218
B
-rw-r--r--
for.rst
4.46
KB
-rw-r--r--
from.rst
275
B
-rw-r--r--
if.rst
1.92
KB
-rw-r--r--
import.rst
1.72
KB
-rw-r--r--
include.rst
2.47
KB
-rw-r--r--
index.rst
238
B
-rw-r--r--
macro.rst
2.61
KB
-rw-r--r--
sandbox.rst
764
B
-rw-r--r--
set.rst
1.64
KB
-rw-r--r--
spaceless.rst
1.14
KB
-rw-r--r--
use.rst
3.18
KB
-rw-r--r--
verbatim.rst
367
B
-rw-r--r--
with.rst
1.07
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : for.rst
``for`` ======= Loop over each item in a sequence. For example, to display a list of users provided in a variable called ``users``: .. code-block:: jinja <h1>Members</h1> <ul> {% for user in users %} <li>{{ user.username|e }}</li> {% endfor %} </ul> .. note:: A sequence can be either an array or an object implementing the ``Traversable`` interface. If you do need to iterate over a sequence of numbers, you can use the ``..`` operator: .. code-block:: jinja {% for i in 0..10 %} * {{ i }} {% endfor %} The above snippet of code would print all numbers from 0 to 10. It can be also useful with letters: .. code-block:: jinja {% for letter in 'a'..'z' %} * {{ letter }} {% endfor %} The ``..`` operator can take any expression at both sides: .. code-block:: jinja {% for letter in 'a'|upper..'z'|upper %} * {{ letter }} {% endfor %} .. tip: If you need a step different from 1, you can use the ``range`` function instead. The `loop` variable ------------------- Inside of a ``for`` loop block you can access some special variables: ===================== ============================================================= Variable Description ===================== ============================================================= ``loop.index`` The current iteration of the loop. (1 indexed) ``loop.index0`` The current iteration of the loop. (0 indexed) ``loop.revindex`` The number of iterations from the end of the loop (1 indexed) ``loop.revindex0`` The number of iterations from the end of the loop (0 indexed) ``loop.first`` True if first iteration ``loop.last`` True if last iteration ``loop.length`` The number of items in the sequence ``loop.parent`` The parent context ===================== ============================================================= .. code-block:: jinja {% for user in users %} {{ loop.index }} - {{ user.username }} {% endfor %} .. note:: The ``loop.length``, ``loop.revindex``, ``loop.revindex0``, and ``loop.last`` variables are only available for PHP arrays, or objects that implement the ``Countable`` interface. They are also not available when looping with a condition. Adding a condition ------------------ Unlike in PHP, it's not possible to ``break`` or ``continue`` in a loop. You can however filter the sequence during iteration which allows you to skip items. The following example skips all the users which are not active: .. code-block:: jinja <ul> {% for user in users if user.active %} <li>{{ user.username|e }}</li> {% endfor %} </ul> The advantage is that the special loop variable will count correctly thus not counting the users not iterated over. Keep in mind that properties like ``loop.last`` will not be defined when using loop conditions. .. note:: Using the ``loop`` variable within the condition is not recommended as it will probably not be doing what you expect it to. For instance, adding a condition like ``loop.index > 4`` won't work as the index is only incremented when the condition is true (so the condition will never match). The `else` Clause ----------------- If no iteration took place because the sequence was empty, you can render a replacement block by using ``else``: .. code-block:: jinja <ul> {% for user in users %} <li>{{ user.username|e }}</li> {% else %} <li><em>no user found</em></li> {% endfor %} </ul> Iterating over Keys ------------------- By default, a loop iterates over the values of the sequence. You can iterate on keys by using the ``keys`` filter: .. code-block:: jinja <h1>Members</h1> <ul> {% for key in users|keys %} <li>{{ key }}</li> {% endfor %} </ul> Iterating over Keys and Values ------------------------------ You can also access both keys and values: .. code-block:: jinja <h1>Members</h1> <ul> {% for key, user in users %} <li>{{ key }}: {{ user.username|e }}</li> {% endfor %} </ul> Iterating over a Subset ----------------------- You might want to iterate over a subset of values. This can be achieved using the :doc:`slice <../filters/slice>` filter: .. code-block:: jinja <h1>Top Ten Members</h1> <ul> {% for user in users|slice(0, 10) %} <li>{{ user.username|e }}</li> {% endfor %} </ul>
Close