'; // constant
// Clean up data.
// Aim is to clean up for clarity AND to signal errors for user to edit.
$speaker = trim($speaker); $date = trim($date); $title = trim($title);
$id = trim($id); $mylink = trim($mylink);
if (preg_match('/^$/', $title)) $title = $err . 'No title given.';
if (preg_match('/^\d{4}$/', $id) == 0) // Must have 4 digits only.
$title = $err . 'Bad id format: ' . $id;
if (preg_match('/^\d+\s*[a-z]+/i', $date) == 0) // Must have digits then alphas
$date = $err . 'Bad date format: ' . $date;
$eventurl = 'https://samoa.dcs.gla.ac.uk/events/viewtalk.jsp?id=' . $id;
$mylinkhtml = '—';
if ($mylink):
$linkword = parse_url($mylink, PHP_URL_PATH );
$arr = pathinfo($linkword);
$linkword = $arr['filename'];
//$linkword = $arr['basename'];
$mylinkhtml =
'' . $linkword . '';
endif;
// Date cmp. Compare just the days / date; not time
$thisdate = strtotime($date);
//$thisdate = strtotime('2017-05-11'); // Tests
//$thisdate = strtotime('11-05-2014'); // these work
//$thisdate = strtotime('20-04-2018'); // these work
//$str = date("jS F, Y", $thisdate); // Tests
//$str = date("jS F, Y", $todaystamp);
$era = ($todaystamp > $thisdate ? 'pastfont' :
( $todaystamp == $thisdate ? 'nowfont' : 'futurefont'));
//$date = " ** $str " . $date; // for tests
//$date = " " . $date . '' ;
if ($todaystamp == $thisdate)
$date = " " . ' Today! ';
else $date = " " . $date;
// if last char of $date is not digit then error
// This must come after setting colour by date relative to the present.
if (preg_match('/\d$/', $date) == 0 && $era != 'nowfont')
$date .= $err . ' ' . date('Y'); //Append the year.
// In the 2nd part of this function, the finished HTML for a row in the table
// is echo-ed out.
$buf = '
Web site logical path:
[www.psy.gla.ac.uk]
[~steve]
[educ]
[this page]
This is my private list of reading group topics: not necessarily always up to
date. For a more definitive list, consult this link:
Events: series 26.
Web site logical path:
[www.psy.gla.ac.uk]
[~steve]
[educ]
[this page]
';
$buf = str_replace('XXdate', $date, $buf); //no REs.
$buf = str_replace('XXspeaker', $speaker, $buf);
$buf = str_replace('XXmylinkhtml', $mylinkhtml, $buf);
$buf = str_replace('XXeventurl', $eventurl, $buf);
$buf = str_replace('XXtitle', $title, $buf);
echo $buf;
};
?>
Last changed
20 April 2018 ............... Length about 900 words (7,000 bytes).XXdate
XXspeaker
XXtitle
XXmylinkhtml
(Document started on 4 April 2018.)
This is a WWW document maintained by
Steve Draper, installed at http://www.psy.gla.ac.uk/~steve/educ/rglist.html.
You may copy it.
How to refer to it.
List of reading group meetings
By
Steve Draper,
Department of Psychology,
University of Glasgow.
Date
Presenter
Title
my link
Future
[Top of this page]