NewsFeaturesDownloadsDevelopmentSupportAbout Us

Plugin ayearago

From LifeType Wiki


Name: ayearago

Download link: http://sourceforge.net/projects/lifetype/files/

License: GPL

Author: Mariano Draghi

Description

This plugin offers various methods to get a list of posts written a year before a given post, or a year before based on the current date.

Usage is as follows.

Configuration

The following methods are available:

  • $ayearago->isEnabled(): To check if the plugin is enabled or not.
  • $ayearago->getOneYearAgoPosts( $post, $maxPosts ): To get the posts (if any) written EXACTLY a year ago the given post. Useful if you post very frecuently.
  • $ayearago->getOneYearAgoPostsFuzzy( $post, $maxPosts ): To get the posts (if any) written between the given post and the previous one, but a year before. This alternative is more useful if you doesn't post that frequently.

These methods (specially the 2nd and 3rd one) are meant to be used in post.template.

  • $ayearago->getRecentArticlesAYearAgo( $maxPosts ): To get the posts written a year ago, based on the current date. This is similar to the normal Recent Articles feature, but for the previous year. This is meant to be used in the header or footer template.

Where:

  • $post is the current post
  • $maxPosts is the max. quantity of posts to return. It's optional. If ommitted plugin_ayearago_maxposts will be used for the 2nd and 3rd methods. If omitted in the 4th call, recent_posts_max is used (same setting as the standard Recent Articles feature).

As an example, this can be added to post.template:

{if $ayearago->isEnabled()}

{assign var="yearAgoPosts" value=$ayearago->getOneYearAgoPostsFuzzy($post)}

{if sizeof($yearAgoPosts) > 0}

<div class="ayearago">

{foreach name=ayearago from=$yearAgoPosts item=yearAgoPost}
 {if $smarty.foreach.ayearago.first}A year ago I was writting: {/if}

 <a href="{$url->postPermalink($yearAgoPost)}">{$yearAgoPost->getTopic()}</a>

 {if !$smarty.foreach.ayearago.last} :: {/if}

{/foreach} 

</div>
{/if}
{/if}