Skip to content
An articles module for the topkit framework http://topicdesign.com
PHP
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
config
controllers
helpers
language/english
migrations
models
views
README.mkd

README.mkd

topkit Articles Module

The topkit Articles Module is a basic blog package, it implements a chronologically organized collection of articles.

All topkit modules are designed specifically to work with our framework, your milage may vary

Articles have the following features:

  • Title
  • Preview
  • Content
  • Publish Date

Articles can be viewed at indexs sorted reverse-chronologically, or at unique URls. Additional URL segments will limit the results included in the paginated index.

/articles
/articles/YYYY
/articles/YYYY/MM
/articles/YYYY/MM/DD
/articles/YYYY/MM/DD/article_title

Config

Parameter Default Description
articles_base_url articles base URL for this module, used to build article URLs
articles_title Articles passed to the topkit->Page module in the constructor
articles_per_page 5 number of articles to list per index page

Usage

Articles generate their unique slug automatically based on the title and published_at properties. Creating an article is simple:

$data = array(
    'title'     => $title,
    'content'   => $content,
);
$article = Article::create($data);

Drafts

If you do not specify a published_at DateTime, or set it in the future, the system saves the article as a Draft.

$data['published_at'] = date_create(); // published now
$data['published_at'] = date_create('tomorrow'); // draft until tomorrow

Draft articles are viewable only to users with permissions to manage articles (handled by the Authority Module). Articles will automatically be available when their published_at date is in the past.

Draft publish dates may be edited up till the time of publishing. Once an article is 'published', the date is no longer editable and the URL assigned maybe considered a permalink.

Installation

This module is not included by default in topkit. Clone this repo as a submodule and create symlinks to use the default controllers/views.

cd topkit
git submodule add git://github.com/topicdesign/topkit-articles.git application/third_party/articles
cd application/controllers
ln -s ../third_party/articles/controllers articles
cd ../views
ln -s ../third_party/articles/views articles

Add a route that uses your prefered base URL.

// application/config/routes.php
$route['articles(.*)'] = "articles/articles$1";
Something went wrong with that request. Please try again.