NP_ItemLastUpdated.php

Nucleus plugin to display TemplateVar which shows the last time an item was updated. Default for new items will be item creation time. Existing items will have no entry in lastupdated and will not show the last updated time, unless edited, and thus the last edited time will be inserted.

General Plugin info
Author: Nick Clarkson
Current Version: 0.3
Code: NP_ItemLastUpdated_code
Demo: None
Forum Thread: Discuss

Installing

The install funstion will test and create the extra 'lastupdated' column in the nucleus_item table

  1. Copy the code below and save is as NP_ItemLastUpdated.php
  2. Upload/copy to your plugins folder
  3. Import the plugin through the admin page

How to use the plugin

  1. Put <%ItemLastUpdated(itemid)%> somewhere in your template - below <%body%> should do for now
  2. Edit/add items and the last edit time gets displayed. It should be easy to edit to how you want.

Available SkinVars and/or TemplateVars

A TemplateVar is used to show when the item is last updated:

<%ItemLastUpdated(itemid)%> 

Options

Tips and Tricks

  1. Time format can be changed in the function doTemplateVar($iitem) using the gmstrftime function

Note

UPGRADING TO NEW INSTALL REQUIRES REMOVING THE OLD VERSION AND INTALLING THE NEW VERSION. THIS WILL LEAVE THE LASTUPDATED COLUMN INTACT. IF YOU WISH TO COMPLETELY REMOVE THE PLUGIN DROP THE LASTUPDATED COLUMN FROM THE ITEM TABLE AFTER REMOVING THE PLUGIN, THEN REMOVE THE TEMPLATEVAR FROM YOUR TEMPLATE(S)

Wishlist

Bugs

The plugin changes the item table in the database by adding a row lastupdated. This is made during the installation and not reversed during the uninstallation. So there should be an option to remove these additional datas during the uninstallation process. - A good way could be if the row lastupdated would be in an additional plugin table (with two rows itemid and lastupdated) to avoid conflicts with the core or other plugins. (2007-11-13 kg)

History

  • 0.1 Initial release (17/01/06)
  • 0.2 Second release (18/01/06)
    • Variable change (changed $itemid to $iitem) for readability
    • Added blog option to choose format of time displayed
  • 0.3 Third release (19/01/06)
    • Added blog option to enable setting the item last updated time equal to item creation time. This is for items that will appear not to have been updated immediately after the plugin is installed.

Plugin Review

NP_ItemLastUpdated version 0.3 works with Nucleus CMS version 3.31 - 2007-11-13 kg

np_itemlastupdated.txt · Last modified: 2007/11/13 01:27 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki