User Guide & Reference Manual

Blogs and Archives

Blogs and archives, created in the control panel, are a way of creating "content listing" pages. While the name "Blogs and Archives" is somewhat functionally-binding, you can actually use this for any type of content listing imaginable. This is highly evident when you see how flexible and easy templating these pages is.

Templates

Each blog is bound to a URL when created, and you can specify any template in your theme's folder to display this blog. The default template - included with standard themes - is blog.thtml.

Template Variables

When the blog template is triggered, the following variables are available for use right away, without any template plugins.

Variables
Variable Description
{$content} An array of the content matching the blog's configured filters as well as limited to the current page, if pagination is in effect. Each item within this array has the same variables as any content item, listed in the designer's content reference. If you have configured your blog to auto-generate a "summary" field, this will be available at {$summary} within each item's array.
{$pagination} A <ul> formatted list of pagination links generated automatically. Can be included in your template as-is.
{$id} The blog ID.
{$link_id} The corresponding link ID in the universal links database.
{$title} The title of the blog.
{$description} The description of the blog.
{$filter_authors} An array of authors allowed in the blog, else FALSE if any author is allowed.
{$filter_topics} An array of topics allowed in the blog, else FALSE if any topic is allowed.
{$type} The content type ID for the blog's content type.
{$type_name} The name of the content type.
{$summary_field} If the blog is auto-generating a "summary" for each content item, this is the system name of the field used for generation.
{$url} The absolute URL to the blog's main page.
{$url_path} The relative path to the blog's main page.
{$auto_trim} If the summary field is being auto trimmed, how many characters is it being cut to?
{$template} The template file used to display the blog.
{$sort_field} The field used to sort the blog.
{$sort_dir} The direction the field is being sorted by, either "ASC" or "DESC".
{$privileges} If restricting access to this blog by usergroup, this is an array of all the usergroups who can see the content.
{$per_page} The number of content items to show per blog page.
{$template} The template file used to display the RSS feed.

Example Blog Template

List the content items on the blog page, and paginate if necessary.


{extends file="layout.thtml"}
{block name="title"}
{$title} - {$smarty.block.parent}
{/block}
{block name="content"}
	<h1>{$title}</h1>
	{$description}
	
	<ul class="blog">
	{foreach $content as $item}
		<li>
			<h4 class="date">{$item.date|date_format:"%A, %B %e, %Y"}</h4>
			<a href="{$item.url}">{$item.title}</a>
			<p class="summary"}>{$item.summary}</p>
		</li>
	{/foreach}
	</ul>
	
	{$pagination}
	
{/block}