Blog Headlines

Outputs a list of blog posts, for example for a homepage feed of headlines.

PHP usage:

string blogheadlines ( integer $posts, mixed $filter, [string $nonfeatured = "false"][, mixed $filter2 = ""]])

CMS usage:




The number of posts to display in the feed. Must be a positive integer. This is the maximum number of posts that will be displayed.

If less than this number of posts match the filter a smaller number may be returned.


Option 1: All Posts, string. Setting filter to string "all" will return posts from all categories and tags.

Option 2: Category, integer. Pass the Blog category ID number. E.g. 2

Option 3: Tag, string. Pass a string of a tag, can contain spaces. E.g. "tagname"

Option 4: Multiple Tags, string. Pass multiple comma separated tags. E.g. "tag1,tag2,tag3"


Optional. By default only posts that have the "Featured" box ticked will show in a headlines feed. Setting nonfeatured to string "true" will also include posts that aren't ticked as Featured.

Note: the featured option can be disabled in config. If disabled, all new posts are automatically featured, and this parameter therefore has no effect.


Optional. This parameter allows a second filter to be applied. If set posts that match either filter or filter2 will be returned. Has the same values as filter.

Config Options

Required. string $config['blog-page-url']

Set this variable to the URL of the page the blog module is hosted on. For example "latest-news/blog".

Optional. boolean $config['blog-feed-hidden']

Defaults to FALSE. If set to TRUE, the link to blogfeed.xml will not be output into the head of the page.


Basic feed, showing 5 posts with no filter:


Category based filtering, showing 5 posts from category 3:


Tag based filtering, showing 10 posts with tag "Europe" or "South America":

%module-blogheadlines-10-Europe,South America%

Basic feed, showing 5 posts with no filters, also including non-featured posts:


Combined category and tag based filtering, showing 3 posts from category 5, with tag "Europe":



The blog headlines module has a template file that allows the output of each post to be modified. The standard output is in "modules/blogheadlines/blogheadlinestemplate.php". To customise this template copy this file to "templates/[template]/blogheadlines.php" and modify as required for your usage.

function blog_headline_display ( array $Row, string $blog_post_link, string  $blog_post_comments_link, integer $blog_post_comments_count )


An array containing the post data. Depending on what fields are in use this array will contain different values.

 The array will always contain the following values:
'post_timestamp' (MySQL date format)
'timestamp' (Unix timestamp format)
'post_text' (full post text)
'cat_id' (integer)
'post_sef_title' (the end part of the URL)
'blog_headlines_result_count' (the number of posts being returned, may be less than the requested number of posts) Unicity CMS >= 3.03 only

Optionally the following values may be present:
'post_intro' (the short post text)
'post_feature' (integer, 0/1)


A link to this blog post. Uses the config variable for the blog page URL and appends the individual post link. E.g. "latest-news/blog/post/123-sef-name"


A link to the comments on the page. E.g. "latest-news/blog/post/123-sef-name#comments"

Note: if comments are disabled on the site, this will still be passed, but won't be present on the page.


The number of comments the post has received. If no comments are received a value of 0 will be passed.