Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

Kind-ofBlog

Summary: A blog for PmWiki - supports posting, digest, archive and syndication
Version: 1.1.1 - 02/09/2006
Prerequisites: requires at least PmWiki version: 2.0.x [?]; last tested on PmWiki version: 2.0.13
Status:
Maintainer: Ryan Varick
Categories: Blog, RSS

Question

Is there a blog for PmWiki?

Answer

Maybe, depending on what you think a blog should be. Right now, Kind-of Blog (KOB) supports:

  1. Posting - wiki-based method of creating blog entries
  2. Digest - list of the most recent blog entries
  3. Archive - graphical view of the year's blog entries
  4. Syndication - RSS feed for blog readers

KOB was originally designed to suit my needs. As such, it is a reflection of what I think a blog should be. If you have ideas for improvements, please feel free to let me know on the Mailing Lists.

Installation

First, download the KOB files:

  1. kob.phpΔ - put this in your cookbook directory
  2. kob.cssΔ - put this in a directory called pub/css

Now add the following to your config.php file:

include_once('cookbook/kob.php');

At this point, the blog should be installed. The next step is to create a few wiki pages to run your blog.

Blog entries are stored as wiki pages, named according to the date the entry was posted (e.g. 20051126). The KOB digest and archive scan a group for date-formatted pages. Therefore, it is probably a good idea to set aside a seperate group for your blog entries (e.g. Blog).

Posting Blog Entries

To post entries, add (:blogpostbox:) to a wiki page. This will create the post form. Entries will be stored in the same group that the post form is called from, so be sure to put the directive on a page that is in the group you set aside for your blog entries. I use Blog.Post, but you're free to call it whatever you'd like.

NOTE: Eventually I would like the post form to be an extension of the built-in PmWiki edit form; for now, it is controlled by $BlogFormFmt in kob.php.

View Existing Entries

There are two ways to view your blog entries: digest view, and archive view. The digest shows the full content of the most recent blog entries (default=6). The archive shows a graphical view of dates that blog entries have been posted. Both work similarly:

  1. For the digest, add (:blogdigest:) to a wiki page
  2. For the archive, add (:blogarchive:)

Unlike the post form, the archive and digest do not have to be in the same group as your blog entries. Both support the group=NAME parameter, which is used to tell KOB where it should look for blog entries. For example, if your blog entries are in Blog, and you want to include the digest on Main.HomePage, the directive would be (:blogdigest group=Blog:).

By default, the archive will list the last 12 months of blog entries. To change this, use the monthsback=N parameter. For example, if you only want to index blog entries created within the past 6 months, you would use (:blogarchive monthsback=6:). Additionally, the archive supports a wrap=N parameter, to control how many months are shown on each row.

NOTE: To control the number of recent blog entries to show on the digest, set the $max_blog_entries variable in kob.php. I know this is limited, and I'd like to add the ability to limit entries by date, but this should work for now.

Syndication

To generate a feed for people to subscribe to, KOB provides an RSS 2.0 feed. It works by parsing the digest page, so you will first need to have a page with the digest directive on it. Then, attach ?action=blogrss to the URL to get the RSS feed.

Note that RSS uses the group name to determine where it should look for blog entires. So while the (:blogdigest:) can be called from any group, the RSS feed needs to be called from the group that contains your blog entries.

The feed may be configured in kob.php. I think it is valid, but please email me if you have any problems with it.

Notes

  • Kind-of Blog builds on RSS Simple and Wiki Calendar, I doubt they will play together!
  • The stylesheet is really just a copy of the Wiki Calendar stylesheet. It fits my theme.
  • A bookmarklet is available that is customised to work with KoB and Tags. You can read about it under "Discussion" on the AddLinkBookmarklet page, or download kob-addlink.phpΔ
  • ...I'm probably forgetting something.

Entry Format

As of 1.1, blog entries are stored with a new format:

 (:blogentry title="TITLE" time="ISO_FORMAT" permalink="Group.Page":)
   wiki markup
 (:blogentryend:)

This is massaged into various formats by the viewer, digest, and RSS feed.

Entry Appearance

The new format allows for much more format flexibility. v1.1 provides a new $kobEntryFmt construct for "easily" configuring the way posts are presented. Refer to the notes in kob.php for more information.

Releases

02/09/2006 - v1.1.1

  • bugfix: date processor no longer tries to transform URLs
  • bugfix: digest processor now counts individual blog entries toward max_blog_entries

12/12/2005 - v1.1.0

  • bugfix: fixed the link to the stylesheet
  • enhanced the archive (add support for group=, monthsback=, wrap=)
  • updated the blog entry format
  • added div wrappers around entries for styling
  • added a template for configuring entry layout

12/10/2005 - v1.0.4

  • bugfix: updated blog RSS to work with the new code from 1.0.3
  • bugfix: removed code that was breaking PmWiki's RSS mechanism

12/10/2005 - v1.0.3

  • bugfix: fixed a function call in the date processor
  • rewrote the way (:blogarchive:) and (:blogdigest:) handle input

12/07/2005 - v1.0.2

  • bugfix: timestamp now uses the date from the entry post form

11/29/2005 - v1.0.1

  • bugfix: days with multiple entries are now formatted properly

11/26/2005 - v1.0.0 - Initial Release

  • Initial release... good luck. :-)

Contributions

Written by Ryan Varick. :-)

Though really, Kind-of Blog is just an amalgamation of two existing PmWiki recipes:

  1. Wiki Calendar, v0.3.22 by John Rank <john.rankin(at)affinity.co.nz>
  2. RSS Simple, v1.1 by Steffen Burmeister <der(at)dolph.de>

Comments

  • It seems to be unpossible to post two entries a day. Do you plan to fix this? MarcSeibert November 27, 2005, at 01:36 PM
    Hmm... well this used to work. It should append the latest entry to the existing page. I think it probably broke when I fiddled with adding permalinks. I'll definitely try to get this fixed ASAP. --Ryan Varick
    The second entry moves always to the top - above the older entry and without date and without title. Wolud be nice to have a timestamp on the top of new entries. But nice script anyway :) MarcSeibert November 28, 2005, at 11:02 AM
    Fixed! v1.0.1 re-attached... let me know if it doesn't work. --Ryan Varick
  • Bye that way: Permanent links don't work with ConditionalExtensions (Permanent Link wil be shown as text but not as a hyperlink) MarcSeibert November 28, 2005, at 11:38 AM
    I've not used that recipe. Would you mind emailing me with more information? Is there an example I can look at? Can you tell me what markup you're using? Also, how do you get your signature to show up with a timestamp? --Ryan Varick
    as for the signature, just use four tildes, like this : JonHaupt November 30, 2005, at 01:30 PM
  • It looks like the blogarchive directive does not take <GROUP.PAGE> as mentioned in the documentation above. Just (:blogarchive:) works, but (:blogarchive <GROUP.PAGE>:) doesn't. --KaushikSridharan December 08, 2005, at 03:12 AM
    Quite right! I reworked the way both of them handle inputs and updated the documentation above. --Ryan Varick December 10, 2005, at 01:10 PM
  • The Blog.RecentChanges page always shows up empty for me. The file exists and there is text in it, but I can't see it in the wiki. Any ideas? --KaushikSridharan December 10, 2005, at 05:41 AM
    Hmmm... when I tried this, PmWiki crashed. I found a misspelled function call in kob.php; after I fixed it, RecentChanges worked. Try v1.0.3 and let me know if that solves the problem. --Ryan Varick December 10, 2005, at 01:10 PM
  • It would be good, if you could also have an editline for the name of the author. flox Feb 10 2006
  • Comments would be cool with commentboxstyled! flox Feb 23 2006
    I'll look into this (and your other idea), thanks for the suggestion. --RyanVarick March 15, 2006, at 08:07 AM
  • Is it possible for severall users of the wiki to have their own blog? March 8 2006
    By using different wiki groups, it should be. The post form will create blog entries in whatever group it is in. So something like <UserName>.Post will create blog entries in a specific user's group. The archive and digest directives both accept a group name as an argument (see above). That, combined with page- or group-level password should let you create any number of personal blogs. --RyanVarick March 15, 2006, at 08:07 AM
  • The default Permalink format is Group.Date (e.g. News.20060330), is there anyway to customize it? I would like it to be News.blogArchive-20060330. - Jacky Mar 30 2006
  • I have created a page called News.news-post and include the kob post form there, but the preview button does not work. Any idea? - Jacky Mar 31 2006
  • If you include a link in the Title Area, the resulting HTML is wrong. For example [[http://www.google.com| The Google]] as a headline/title will render incorrectly. To fix the problem, I changed the following line in kob.php:
$entryFmt['title'] = MarkupToHTML('', str_replace('$title', $args['title'], $entryFmt['title']));
to
$entryFmt['title'] = str_replace('$title', $args['title'], MarkupToHTML('', $entryFmt['title']));
It seems to work. - Rohan April 17 2006
  • I think this is also happening if you have wikiwords being turned into links automatically. IE having "PmWiki is cool" in your title will mess things up pretty bad. Rohan's fix probably corrects this, but I did not test. - Tim april 26, 2006
  • I wasn't happy with the way the date appears in the title area of each blog entry, unformatted, as in 20060501, so I added some code to kob.php that displays the actual entry title as the page title:
In kob.php, find the following line in the format_kob_entrystart($match) function
$string = "<div class=\"$\">\n";
Replace it with
$string = "(:title $args[title]:)"; $string .= "<div class=\"$\">\n";
Of course, with multiple entries on a single day, this displays the last entry's title (being the one posted earlier in the day) as the title for the page. Another reason to have KoB keep each entry on its own page. Andy June 08, 2006, at 10
25 AM
  • It's blog , therefore the blogarchive concerns only the past. If it could be the future your blog can be uses as an agenda, a project papers... but how have (:blogarchive monthsahead=3 monthsback=3 wrap=1:) in the sidebar ? Thanks !

Pierre79

  • June 10, 2007 - For anyone who is, or will be, using CleanUrls, be sure to check your rss feed url after enabling clean url's. Someone notified me today that my blog rss url was returning a 404 error, and this is due to switching to clean url's and failing to update my blog rss url. Ian MacGregor
  • June 12, 2007 - I am creating a site and have found Kind-of-Blog to be the better PM Wiki blog recipe. I want my feed used on a planet agregator, and found the RSS feed it generates is better. But, I have found a lack of flexibility in input and output forms. Perhaps creating a solution that incorpates fox forms, page lists, and Kind-of-Blog RSS parser would make the perfect blog recipe. Ausimage
  • I was having trouble getting through W3C validation on pages with the blogdigest on them. The problem was that the markup was getting surrounded by "<p> / </p>" tags which was killing the validation on the div elements. After some investigation, it looks like the markup line for the digest was using a "Keep" pool of 'L' (which I believe is links). Just removing this second parameter to keep for the digest markup and letting it use the default seemed to do the trick for me. -- lordmundi September 17, 2007, at 04:10 PM
  • I use KoB for a news section and wanted it to send a mail to a list of mail addresses when posting a new item. You may like to include this into your Blog, too.
    • In kob.php, find the config section:
      /* =============== Configuration =============== */
      Add:
      SDV($kobMailSubject, 'New blog entry' );
    • Again, find
      function HandleBlogPost($pagename)
      Replace
      global $_POST, $TimeFmt, $SpaceDateString, $blogTimestampStyle, $blogPermalinkStyle;
      with
      global $_POST, $TimeFmt, $SpaceDateString, $blogTimestampStyle, $blogPermalinkStyle, $kobMailTo, $kobMailFrom, $kobMailSubject, $ScriptUrl;
    • Again, find\\
    $blog_entry_timestamp = strftime("m-H:%M", $blog_entry_unix_time);
after, add: if ( is_array($kobMailTo) ) { $mailtext = $blog_entry_title . "\n\n" . $_POST['text'] . "\n\n" . $ScriptUrl . "?n=" . $blog_entry_name . "\n"; foreach ( $kobMailTo as $address ) { mail( $address, $kobMailSubject, $mailtext, "From: \"Webmailer\" <".$kobMailFrom.">\nX-Mailer: PHP/" . phpversion() ); } }
  • In your config.php (or farmconfig.php), you can now add some new options:
    add
    $kobMailTo = array( <comma seperated list of mail addresses> );
    $kobMailFrom = '<From address>';
    $kobMailSubject = '<Mail subject>';

That's it! bmartino?

Edit - History - Print - Recent Changes - Search
Page last modified on January 19, 2008, at 01:50 PM