NP_HowMuchTime.php

Code Available in the Nucleus Forum at http://forum.nucleuscms.org/viewtopic.php?t=2811 (Author: TrenT)

This plugin can be used to calculate how much time has gone by since an event in the plugin parameters. If item is in the past, it will show “ago” at the end of the string. There is a format option to place HTML tags or CSS tags in the plugin options. This plugin is similar to another one I wrote in NP_Countdown, but has the option for displaying years, months, weeks and days versus just days in that plugin.

Usage is: <%HowMuchTime(detail,year,month,day,event)%>. If item is in the past, it will show “ago” at the end of the string. Sample usage would be: Parameters are: <%HowMuchTime(detail,year,month,day,event)%>.

Detail is a number between 1 and 4 with:

  • Detail 1 shows years only
  • Detail 2 shows year and months
  • Detail 3 show year, months, and weeks
  • Detail 4 shows years, months, weeks and days.

<%HowMuchTime(4,2002,5,10,Started Journal)%> would show:

Started Journal - 2 years, 6 months, and 3 days ago

Installing

Copy and paste the code from the nucleus forum at http://forum.nucleuscms.org/viewtopic.php?t=2811 into a file called NP_HowMuchTime.php. Upload the file into the nucleus plugin directory, than install or update the subscription list. Include usage code (shown above) in your skin where you want the output to appear.

History

  • Version 1 is the original code.
  • Version 2 is the newest code

TrenT

:: Back to Plugins Overview ::

howmuchtime.txt · Last modified: 2006/07/05 13:03 (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