Blog

The main module for running a blog on your website.

PHP usage:

include_once('modules/blog/index.php');

string blog ( [ integer $number, [ mixed $cat ]] )

CMS usage:

%module-blog-[$number=10[-$cat=0]]%

Parameters

number

The number of posts per page to display (integer). If not set, defaults to 10.

cat

Mixed variable, can be used either to filter by category or tag.

Category: set the integer value of the category ID you wish to display.

Tag: set a string value of the tag or tags (comma separated) you wish to display. Example: "Tag1" or "Tag 1,Tag 2".

Config Options

Optional. boolean $config['blog-numbered-pagination']

Defaults to FALSE. If set to TRUE, uses numbered pagination instead of previous/next links.

Optional. integer $config['blog-max-pages']

For use with numbered pagination. Setting this variable allows you to configure the maximum number of pages that will be displayed at any time in the pagination. Defaults to 10.

Optional. boolean $config['blog-show-all-numbers']

For use with numbered pagination. Defaults to FALSE. If set to TRUE will show every page number in the pagination. It is generally not advisable to use this option, as the number of pages will grow over time to a potentially unworkable number.

Optional. string $config['blog-previous-posts-text'] and $config['blog-more-posts-text']

Overrides the text of the "previous posts" and "more posts" links.

Default values come from $lang['blog-previous-posts'] and  $lang['blog-next-posts'] (which can also be set in a custom language file).

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

Defaults to FALSE. If set to TRUE disables the link to the blog RSS feed being output into the head of the page.

Required. string $config['blog-feed-name']

Required if a blog feed is in use. For example: "Website Name's Blog"

Optional. boolean $config['blog-enable-comments']

Defaults to FALSE. If set to TRUE, blog commenting will be enabled.

Optional. boolean $config['blog-comments-disable-moderation']

Defaults to FALSE. If set to TRUE, comments will go live without moderation.

Optional. string $config['blog-comments-notification']

If set, an email will be sent to the address within the variable when a new comment is posted. For example: "notify@yoursite.com" or for multiple notifications use comma separated values: "notify@yoursite.com,notify2@yoursite.com"

Examples

Basic usage

%module-blog%

Basic usage, but with 12 posts per page

%module-blog-12%

Showing posts from category 1 only, 10 posts per page

%module-blog-10-1%

Showing posts using tag "Tag 1", 10 per page.

%module-blog-10-Tag 1%

Template

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

Blog Summary and Blog Post display

The blog summary function is used to output a post on the blog front page, where multiple blog posts will be displayed. The blog post display function is used to output a single post page.

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

Row

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_id'
'post_title'
'post_author'
'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)

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

blog_post_link

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"

blog_post_comments_link

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.

blog_posts_comments_count

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

Blog Comments Title

Outputs a title above the comments section

function blog_comments_title ( )

Blog Comment Display

Outputs a blog comment

function blog_comment_display ( array $Row )

Row

An array containing the comment data.

The array will contain the following values:

'comment_name'
'comment_email' (Should not be shown on screen for privacy reasons)
'comment_text'
'comment_approved' (Integer, 0 if not approved, 1 if approved)

No Comments

Outputs some HTML if there are no comments posted

function blog_no_comments ( )

Comment Intro

Outputs HTML above the comments section

function blog_comment_intro ( )

Comment Submitted Message

Outputs a thank you message when a comment is submitted

function blog_comment_submitted ( )

Comment Outro

Outputs HTML below the comments section

function blog_comment_outro ( )