Post template with tags: a film page
A post page is not a PHP file but text with markup and tags, and the site owner edits it in the panel.
A post page is not a PHP file but text with markup and tags, and the site owner edits it in the panel. A tag inserts the value of the post or of a field, a condition shows a part only when the value exists, and a loop goes through a list (genres, tags, gallery). The previous text is never lost: the last 20 versions are stored, and each has a “Restore” button.
Ready-made sample: “Cinema”
In “News → Post templates” click “Install “Cinema””: a category “Films”, 8 custom fields (poster, year, country, genres, duration, rating, cast, trailer), a page template and three sample posts appear. Installing again duplicates nothing; the samples are removed with the “Remove samples” button.
The text of the page template:
<div class="news-custom news-custom--film">
[if:field:poster]<div class="news-custom__poster">{field:poster size=300x450}</div>[/if]
<div class="news-custom__info">
<h1>{title}</h1>
<dl>
[if:field:year]<dt>{fieldlabel:year}</dt><dd>{field:year}</dd>[/if]
[if:field:country]<dt>{fieldlabel:country}</dt><dd>{field:country}</dd>[/if]
[if:field:genre]<dt>{fieldlabel:genre}</dt><dd>[each:field:genre]<span>{item}</span> [/each]</dd>[/if]
[if:field:duration]<dt>{fieldlabel:duration}</dt><dd>{field:duration}</dd>[/if]
[if:field:rating]<dt>{fieldlabel:rating}</dt><dd>{field:rating}</dd>[/if]
[if:field:cast]<dt>{fieldlabel:cast}</dt><dd>{field:cast}</dd>[/if]
</dl>
</div>
<div class="news-custom__body">{body}</div>
[if:field:trailer]<div class="news-custom__trailer">{field:trailer}</div>[/if]
</div>What you honestly see. The sample posts have no poster, so the poster block is not shown (the condition [if:field:poster]). The news-custom* styles are now in the common layer: labels and values of the data are laid out in rows, genres as tags, the rating as stars, and at 390 there is one column with no horizontal scrolling.
What the tags output
| Tag | What it outputs | Example |
|---|---|---|
{id} | the post number | {id} |
{title}, {title limit=60} | the title (with truncation) | <h1>{title}</h1> |
{url} | the post address | <a href="{url}"> |
{site} | the site name | {site} |
{date}, {date format=d.m.Y} | the publication date; without format it is d.m.Y; a format with spaces goes in quotes | <time>{date format="d F Y"}</time> |
{author} | the author | {author} |
{category}, {category.url} | the category and the address of its page | <a href="{category.url}">{category}</a> |
{excerpt}, {excerpt limit=160} | the short text | <p>{excerpt limit=160}</p> |
{body} | the full text of the post | {body} |
{cover}, {cover size=400x300} | the post cover; without size it has no dimensions | {cover size=600x400} |
{views}, {comments} | views and comments | {views} · {comments} |
{readtime} | minutes to read | {readtime} min |
{rating} | the average reader rating (1–5 stars); empty if there are no ratings | [if:rating]★ {rating}[/if] |
{rating.count} | the number of ratings | ({rating.count}) |
{rating.stars} | the stars as ready-made markup (HTML only) | {rating.stars} |
{likes} | the number of ratings (here the same as {rating.count}) | {likes} |
{author.url} | the address of the author's profile | <a href="{author.url}">{author}</a> |
{comments.url} | the address of the post's comments block | <a href="{comments.url}">Comments: {comments}</a> |
{comments.word} | the word “comment” in the right form for the number | {comments} {comments.word} |
{edit_url} | the address for editing the post (visible to those who are allowed) | [if:can_edit]<a href="{edit_url}">Edit</a>[/if] |
{editor}, {edit_date format=…} | who edited the post and when | Edited by {editor}, {edit_date format="d.m.Y"} |
{share} | the “Share” buttons | {share} |
{favorite_button} | the “Bookmark it” button | {favorite_button} |
{field:NAME}, {field:NAME limit=N size=WxH} | the value of a custom field; limit for text, size for a picture | {field:year} |
{fieldlabel:NAME} | the label of the field | <dt>{fieldlabel:year}</dt> |
Inside a loop: {item}, {item.url}, {item.alt} (the caption of a picture in a gallery), {index} — the number starting from one.
| Condition or loop | What it does | Example |
|---|---|---|
[if:name]…[/if] | shows the part if the value exists | [if:cover]{cover}[/if] |
[ifnot:name]…[/ifnot] | shows the part if the value does not exist | [ifnot:excerpt]no description[/ifnot] |
[if:name=value]…[else]…[/if] | compares | [if:field:rating=5]★[else]—[/if] |
[if:pinned]…[/if] | the post is pinned | [if:pinned]📌[/if] |
[if:new]…[/if], [if:updated]…[/if], [if:edited]…[/if] | the post is new (within news.new_hours, 24 by default, 0 turns it off), updated (news.updated_hours), or was edited | [if:new]<b>New</b>[/if] |
[if:can_edit]…[/if] | the visitor has the right to edit the post | [if:can_edit]…[/if] |
[if:role=a,b]…[/if] | the visitor has any of the listed roles | [if:role=editor,admin]…[/if] |
[each:tags]…[/each] | the tags of the post | [each:tags]<a href="{item.url}">{item}</a>[/each] |
[each:field:NAME]…[/each] | a field with several values (genres, gallery) | [each:field:genre]<span>{item}</span>[/each] |
Names for [if:…]: title, excerpt, body, cover, author, category, views, comments, tags, rating, pinned, new, updated, edited, can_edit, field:NAME. Rating is turned on by the post flag “Allow rating” and the “News” settings (news.rating, news.rating_guests, news.show_views): one rating per reader, a guest is recognized by a hash; a view is counted once per session, and robots are not counted. In the feed and on the page of a tag view, {rating}, {rating_count}, {views} and {rating_url} are available. Options: limit is a number from 1 to 5000 (a smaller or larger value is clamped to the limit) and cuts by characters with “…”; format of date allows only the characters d D j m M n Y y H i s a A g G h F, a space, ., /, :, -, up to 20; size is WxH (width x height), each side up to 4000, otherwise it is ignored.
Security and limits
PHP, function calls and file reading do not work. The markup is cleaned against an allowlist (no script, style, form, iframe, on*, data-*); addresses may only be http(s)://, /path or #. The template is limited to 20000 characters, 400 tags, nesting depth 6 and 60 repeats.
Updated 16.10.2026
No one has commented yet. Be the first.