Category Browser plugin for LifeType.
Author: Jon Daley
URL: http://limedaley.com/
Example URL using this plugin: http://jon.limedaley.com/
The default getNext and getPrev post do not obey category boundaries,
and you might have readers who are only interested in certain
categories.
This plugin has four functions to get the first, previous, next, and
latest posts in any given category.
Here are the available functions:
{assign var="postInCategoryFirst"
value=$categorybrowser->getFirstArticle($categoryId, $blogId)}
{assign var="postInCategoryPrev"
value=$categorybrowser->getPrevArticle($post, $categoryId, $blogId)}
{assign var="postInCategoryNext"
value=$categorybrowser->getNextArticle($post, $categoryId, $blogId)}
{assign var="postInCategoryLast"
value=$categorybrowser->getLastArticle($categoryId, $blogId)}
Here is the code I use in my template, it might be fancier that you
want, but I think this looks pretty good.
Category
{foreach name=categories from=$post->getCategories()
item=postCategory}
{assign var=categoryName value=$postCategory->getName()}
{assign var="blogId" value=$blog->getId()}
{assign var="categoryId" value=$postCategory->getId()}
{assign var="postInCategoryFirst"
value=$categorybrowser->getFirstArticle($categoryId, $blogId)}
{assign var="postInCategoryPrev"
value=$categorybrowser->getPrevArticle($post, $categoryId, $blogId)}
{assign var="postInCategoryNext"
value=$categorybrowser->getNextArticle($post, $categoryId, $blogId)}
{assign var="postInCategoryLast"
value=$categorybrowser->getLastArticle($categoryId, $blogId)}
{$categoryName}:
{if $postInCategoryFirst &&
($postInCategoryFirst->getId() != $post->getId())}
[first]
{/if}
{if $postInCategoryPrev &&
($postInCategoryPrev->getId() != $postInCategoryFirst->getId())}
[previous]
{/if}
{if $postInCategoryNext &&
($postInCategoryNext->getId() != $postInCategoryLast->getId())}
[next]
{/if}
{if $postInCategoryLast &&
($postInCategoryLast->getId() != $post->getId())}
[newest]
{/if}
{/foreach}