Tags in the news entry template
Which values, conditions and loops the text entry template understands, with their options and limits.
Edited in News → Entry templates (samples “Blog” and “Movie card”; up to 20 versions are kept, each with a “Restore” button). A template is plain text with HTML markup into which tags in curly and square brackets are inserted. This is separate from PHP template helpers: the tag language contains no PHP and the owner edits it in the panel.
Values
| Tag | What it prints | Example |
|---|---|---|
{id} | entry number | {id} |
{title} | title; the limit=N option truncates | {title limit=60} |
{url} | entry address | <a href="{url}"> |
{site} | site name | {site} |
{date} | publication date; the format= option sets the look | {date format=d.m.Y} |
{author} | author name | {author} |
{category} | category name | {category} |
{category.url} | category page address | <a href="{category.url}"> |
{excerpt} | short text; option limit=N | {excerpt limit=160} |
{body} | full text of the entry | {body} |
{cover} | cover; option size=WxH | {cover size=600x400} |
{views} | number of views | {views} |
{comments} | number of comments | {comments} |
{readtime} | minutes to read | {readtime} |
{field:NAME} | value of the entry’s own field; options limit=, size= | {field:director} |
{fieldlabel:NAME} | field label | {fieldlabel:director} |
Tag options and defaults
| Option | Where it works | If not given | If given |
|---|---|---|---|
limit=N | title, excerpt, body and text fields | text is not truncated | a number from 1 to 5000 (smaller or larger is brought to the bound), truncated by characters with “…”; body prints plain text without markup; a non-numeric value is ignored |
format=… | date | d.m.Y | only the characters d D j m M n Y y H i s a A g G h F, space, ., /, :, - are allowed, up to 20; otherwise also d.m.Y |
size=WxH | cover and image field | image without width and height | for example 300x450, each side up to 4000; otherwise the option is ignored |
Correct form: {cover size=400x300}, {date format=d.m.Y}, {excerpt limit=160}.
Inside a loop ([each:…]): {item} is the current element, {item.url} its address (for tags and files), {item.alt} the picture caption (for a gallery), {index} the ordinal number from one.
Entry page tags
Neighbouring and related entries, print, text pages, pictures by number, the author card, a poll and a report. Every value passes an allow-list: text is escaped, addresses are only a path from the root or https://.
| Tag | What it prints |
|---|---|
{previous.title} {previous.url} {previous.date} {previous.excerpt} {previous.cover_url} | the previous (older) entry; empty if none. The same for {next.…} — the next one |
{item} {item.url} {item.excerpt} {item.date} {item.cover} inside related entries | related entries (those named in the entry) |
{print_button} | the “Print” button (works without theme scripts) |
{pages} {page.current} {page.total} {page.prev_url} {page.next_url} | an entry split by [page] marks: list of pages, number, count, links; empty for an unsplit entry |
{image:1.url} … {image:20.url}, {images.count} | pictures of the entry text in order; empty if there is no such one |
{author.avatar_url} {author.bio} | the author’s avatar and “About me” — only if the author’s profile is open |
{author.role} {author.role_name} | the author’s senior role: label and machine name; in a condition either fits, several may be given with commas |
{author.posts} {author.rss_url} | how many entries the author has on the site; the author’s feed |
{poll} | the entry’s poll (if one is chosen) |
{poll.question} {poll.status} {poll.votes_text} {poll.url} {poll.close_date} {poll.start_date} | the poll in parts: question, “open/closed”, how many answered; totals appear per the poll setting (“always”, “after answering”, “after closing”) — until then the counters are empty |
{item.id} {item.votes} {item.percent} {item.bar} {item.votes_text} {item.input} inside poll options | poll options: name, votes and share (after totals are shown), the ready voting field |
{poll_form_open} {poll_submit} {poll_form_close} {poll_note} | the voting form in pieces (with a protection key) and a note on why voting is not possible; empty while voting is not possible |
{report} | “Report this entry” — an expanding form (needs comments and reports turned on) |
{comments.subscriptions_url} | the “My subscriptions” page (for a signed-in person) |
{comments_follow} | the “Follow comments” button (one click for a signed-in person, by email with confirmation for a guest) |
{archive_day.url} | the news archive for the entry’s publication day |
Examples: [if:next.url]<a href="{next.url}">{next.title} →</a>[/if], [each:related]<li><a href="{item.url}">{item}</a></li>[/each], [if:page.total]{pages}[/if], [if:author.role=editor,admin]Editorial[/if].
Conditions and loops
| Form | What it does |
|---|---|
[if:name]…[/if] | prints the piece if the value exists (is not empty) |
[ifnot:name]…[/ifnot] | prints it if there is no value |
[if:name=value]…[else]…[/if] | compares with a value, otherwise the second branch |
[each:tags]…[/each] | repeats over the entry’s tags |
[each:field:NAME]…[/each] | repeats over a multi-value field: multiple choice, gallery |
Names available in conditions: title, excerpt, body, cover, author, category, views, comments, tags, field:NAME.
Comparisons: greater, less, not equal
A condition can take an operator: [if:year>2000], [if:price<=100], [if:genre!=drama], [ifnot:year>=2030]. Operators: =, !=, >, <, >=, <=. If both parts are numbers (a comma counts as a point), numbers are compared, otherwise text is compared ignoring case. An empty or missing value does not pass “greater/less” comparisons.
List parameters: key=value
A list can be tuned with parameters separated by spaces — after the name, before the closing bracket:
[each:news_list category=films,serials limit=5 sort=views field:year>2000]
<a href="{item.url}">{item.title}</a>
[/each]The familiar form news_list:cat:3:limit:5 works as before and means the same — use either.
| Parameter | Meaning |
|---|---|
category (cat) | categories: number or name, a list 3,5, a range 3-7, exclusion !news (subtracted from a range: 3-7,!5) |
not_category | categories to exclude |
limit / start | how many entries (1–100) / where to start |
sort | order: new, old, title, views, rating, rand |
days | over how many recent days |
author (user), tag | author and tag by number |
field:NAME | by an extra field: field:year>2000, field:genre!=drama, field:director=Kubrick |
home, fixed, cover, poll, password, comments, featured | flags; yes/no, 1/0 are accepted |
lang, cache | language and how many seconds to keep the result (up to an hour, for guests only) |
The template editor flags an unknown parameter with a warning and the line; a tag takes up to eight parameters. A value with spaces is written in quotes: title="two parts". Which parameters your particular list supports is shown in that list’s insert.
Safety and limits
| Rule | Value |
|---|---|
| PHP, function calls, reading files and settings | none — the language can only insert a value, check “is there one” and walk a list |
| Template HTML | cleaned by an allow-list: no script, style, form, iframe, no on* and data-* attributes |
Addresses in href/src | only http(s)://, a path from the root /… and #… |
| Template size | at most 20000 characters |
| Number of tags | at most 400 |
| Nesting of conditions and loops | at most 6 levels |
| Repeats in a list | at most 200 |
| Result size | at most 300000 characters |
Values are escaped in place: in text, in an attribute and in an address differently, so an entry title with a quote or a tag does not break the layout.