Angerwhale::Controller::Categories - Generate a blog listing of recent articles in a given category, optionally filtered by date
Main page is category /.
/
Renders articles in category $ARG.
$ARG
Gets a list of articles to show. The first argument is the name of the category to display, or q{} (an empty string) for the "root" category. If there's another argument, it should be a date in the form:
(YYYY, MM, DD)
Processing of articles will begin on this date, such that all articles on that day are shown, then YYYY, MM, DD-1; and so on, until articles_per_page articles have been selected for display. If there are more than articles_per_page articles from a single day, they will all be displayed regardless of the articles_per_page setting. (Just for general sanity; not likely to happen in real life.)
articles_per_page
Config options that are used:
If an articles has fewer than this number of words, it is displayed in "mini" form, unless it's the first article on the page. Defaults to 150.
How many articles to display before the "42 older articles" link is displayed. Can be overridden by sepcifying articles_desired in the stash. Defaults to 5.
articles_desired
To deal with paging, newer_articles and older_articles are set to the dates of newer and older articles.
newer_articles
older_articles
($before_ref, $current_ref, $after_ref) = _split_articles($articles_ref, $args_ref)
Splits the array reference $articles_ref into three arrays, before, current, and after. The article list should be sorted, with the most recent article first. If this isn't the case, expect something bad to happen.
$articles_ref
$args_ref is a hash reference containing:
$args_ref
An array reference to the date array: [year, month, day].
For example, [2006, 07, 31] is July 31, 2006.
How many articles to put on the "current" page.
XXX: Note that I'm being lazy about checking validity of paramaters. Don't set articles_per_page to be -42 or sort the array backwards. If you do that, expect something bad to happen. RTFM.
Throws an exception if the date is not valid.
Given an article, returns the date in yyyy/mm/dd format.
Jonathan Rockway
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install Angerwhale, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Angerwhale
CPAN shell
perl -MCPAN -e shell install Angerwhale
For more information on module installation, please visit the detailed CPAN module installation guide.