FplByDays

Summary: fmt=bydays for pagelists; A custom format for YYYYMMDDHHMM format page names.
Version: 2007-03-23
Prerequisites: Last tested on pmwiki-2.2.0-beta39, however this should work with previous version.
Status: Functional; I am happy with it.
Maintainer: Feral
Categories: Searching, FPL PageList
Discussion: FplByDays-Talk?

Questions answered by this recipe

How do I display a group of date/time stamped page names, well, 'pretty'?

Description

fmt=bydays for pagelists; A custom format for YYYYMMDDHHMM format page names.

This is a custom solution I desired for my listing of blog like pages that are each named with the date/time they were created on in the format YYYYMMDDHHMM, which for clarity and ease of reading is YYYY MM DD HH MM without spaces; Where HH is 24h time; This is the same as produced by: strftime("%Y%m%d%H%M", time() ), such as $FmtPV['$blogpagename'] = 'strftime("%Y%m%d%H%M", time() )';.

To use:

In your config.php, place:

// (:pagelist group={$Group} list=normal fmt=bydays:)
include_once("$FarmD/cookbook/fplbydays.php");

Usage:

All you need to do is specify the format parameter of the pagelist directive as bydays, i.e. fmt=bydays, or as a complete example,

 

In a group which has pages with names like:

  • 200703220054
  • 200703211934
  • 200703211200
  • AnExamplePage

This will result in:

2007-03-22 * 2007-03-21 * A
----
^ Thursday, March 22, 2007 (2007-03-22)
    12:54:AM, $Description
^ Wednesday, March 21, 2007 (2007-03-21)
    7:34:PM, $Description
    12:00:PM, $Description
^ A
    An Example Page

With pretty colors and stuff. ;)

To customize:

NOTE: The naming convention is "date" to signify a YYYYMMDDHHMM style pagename, else "norm" is used;

The link style is defined by:

// Link format; we do not want underlines;
SDV($HTMLStylesFmt['fplbydays'], "
a.bydaysdate,
a.bydaysnorm
{
  text-decoration:none;
}
");
  • Quick search section, i.e. "2007-03-22 * 2007-03-21 * A" part.
    • $FPLByDaysStartFmt is the start format for this section.
      • $FPLByDaysEndFmt is the closing to the above($FPLByDaysStartFmt);
    • $FPLByDaysHeaderLink is the format for each individual quick link in this section.
  • The listing section, i.e.
    • The YYYYMMDDHHMM pages:
      • $FPLByDaysLDateFmt is the format for each day heading, i.e. "^ Thursday, March 22, 2007 (2007-03-22)"
      • $FPLByDaysIDateFmt is the format for each day page, i.e. "12:54:AM, $Description"
    • Everything else:
      • $FPLByDaysLNormFmt is the format for each norm heading, i.e. "^ A"
      • $FPLByDaysINormFmt is the format for each norm page, i.e. "An Example Page"

Set these before you include this recipe. Say for instance:

// FPL By days:
$FPLByDaysIDateFmt = "<dd><a class=bydaysdate href='\$PageUrl'>\$TimeFromName, \$Title</a></dd>";
// (:pagelist group={$Group} list=normal fmt=bydays:)
include_once("$FarmD/cookbook/fplbydays.php");

Notes

This is based on extdictindex.php, found at: DictIndex.

  • This is customized to my needs with pages named in the format of YYYYMMDDHHMM;
  • It is a hack job and rushed into service. It SEEMS to work just fine however and is nothing complicated code wise.
    • I have not extensively tested this but it is based on code I have been using for ages (fmt=dictindex)
    • It should be fine, but please make sure it works the way you expect before you take it for granted (=

IF there is call for it I will endeavor to make this work with YYYYMMDD style page names as produced by PmCal and other blog like solutions, however this major point of this is to group pages by day which is rather pointless with that page naming scheme as each page IS a single day. In essence, Please tell me what you would like and I will see if I can work it in.

As an aside, a handy PageVar for this style of page name:

$FmtPV['$blogpagename'] = 'strftime("%Y%m%d%H%M", time() )';

Release Notes

  • 2007-03-23 -- Bug fix; If no files are present, return "No files found.";
  • 2007-03-22 -- Initial.

See Also

Contributors

Comments

See Discussion at FplByDays-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.