RunCGI-Talk

Summary: Talk page for RunCGI.
Maintainer: PmWiki community
Users: (View? / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Here is what the final script looks like.

<?php if (!defined('PmWiki')) exit();
#
#   This recipe calls TTC's perl program for displaying club nights
# Version date
$RecipeInfo['ClubNight']['Version'] = '2012-09-09';
$FmtPV['$ClubNight'] = $RecipeInfo['ClubNight']['Version']; // return version as a custom page variable
# 2012-09-09 Initial version

# declare $ClubNight for (:if enabled ClubNight:) recipe installation check
global $ClubNight; $ClubNight = 1;
/*  
    Copyright 2012
    This program is free software; you can redistribute it and/or modify it under the 
    terms of the GNU General Public License as published by the Free Software Foundation;
    either version 2 of the License, or (at your option) any later version.  
*/
Markup('ClubNight', 'fulltext', '/\\(:clubnight\s*\b(next|future)?\s*:\\)/ei',
  "Keep(ClubNight($1))");

function ClubNight($displaytype) {
  $debugit = 0; // 1 to debug, otherwise 0
  $retval = '';
  if ($debugit) {$retval = "Version 7 '$displaytype': ";}
  $lastline = '';
  $output = '';

  $lastline = exec("../cgi-bin/tuesdaynight.pl $displaytype", $output); // return result of executing file
  if ($debugit) {
      $retval .= pre_r($output);
  } else {
      $retval .= implode ("\n", array_slice ($output,0));
  }
  return $retval;
}

It doesn't claim to be an exemplar of PHP or Regex, its just an example. I'm sure more experienced can and will improved. But it works.

Talk page for the RunCGI recipe (users?).