Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.macros.viewWeblog
on viewWeblog () {
<<Changes
<<11/5/02; 1:22:31 AM by JES
<<Reversed the last change.
<<10/28/02; 7:38:56 PM by JES
<<Call html.processMacros with plainprocessing as true to prevent extra paragraph tags.
<<9/3/02; 3:40:20 PM by LL
<<Added support for weekly weblog archives.
<<Directive:
<<#flWeeklyArchive -- set to true for weekly archive pages.
<<8/26/02; 10:39:22 PM by LL
<<Added support for monthly weblog archives.
<<Directive:
<<#flMonthlyArchive -- set to true for monthly archive pages.
<<11/29/01; 11:43:34 PM by JES
<<Store the category name and description in the pagetable as siteName, and description respectively. The category's name and description override the default weblog siteName and description.
<<11/24/01; 8:15:08 PM by JES
<<Call html.processMacros on the rendered text, to expand glossary items and macros.
<<11/15/01; 12:40:08 AM by JES
<<The format of the #archiveDate directive changed from d/m/yy to yyyy/mm/dd, so this script needed to parse pta^.archiveDate accordingly.
<<If dynamic rendering (not pta^.radioResponder.flStaticRendering), return the empty string. This maintains the duality between the editorial interface in the dynamic site (for both weblog pages and category pages), and the static site, where the editorial interface is replaced by a weblog rendering.
<<11/11/01; 11:43:57 PM by JES
<<Created.
<<The bottleneck for rendering weblog and weblog category content in Radio 7.1.
<<This script renders the weblog home page, weblog archive pages, category index pages, and category archive pages.
<<It gets the info it needs from directives in the files on disk, which correspond to the page to be rendered.
<<Directives are:
<<#flArchivePage -- set to true for archive pages.
<<#archiveDate -- set to the date for the archive page, for archive pages.
<<To get the HTML we need, we build the params we need, and then call radio.weblog.render.
<<Based on radio.weblog.view.
local (pta = html.getPageTableAddress ());
local (adrblog = radio.weblog.init ());
if not pta^.radioResponder.flStaticRendering { //return the empty string for the dynamic weblog editor page
if pta^.path == radio.data.systemUrls.weblogEditor {
return ("")}};
local (flArchivePage = html.getPref ("flArchivePage", pta));
local (flMonthlyArchive = false, flWeeklyArchive = false);
if defined (pta^.flMonthlyArchive) {
flMonthlyArchive = pta^.flMonthlyArchive};
if defined (pta^.flWeeklyArchive) {
flWeeklyArchive = pta^.flWeeklyArchive};
local (catname);
if defined (pta^.categoryName) { //get catname
catname = pta^.categoryName;
pta^.description = adrblog^.categories.[catname].description;
pta^.siteName = adrblog^.categories.[catname].displayName};
local (daytemplate = string (file.readwholefile (pta^.radioResponder.atts.dayTemplate)));
local (itemtemplate = string (file.readwholefile (pta^.radioResponder.atts.itemTemplate)));
local (maxdate, mindate);
if flArchivePage {
local (archiveDateString = pta^.archiveDate);
local (year = string.nthField (archiveDateString, "/", 1));
local (month = string.nthField (archiveDateString, "/", 2));
local (day = string.nthField (archiveDateString, "/", 3));
mindate = date.set (day, month, year, 0, 0, 0);
maxdate = date.set (day, month, year, 23, 59, 59)};
if flMonthlyArchive {
local (archiveDateString = pta^.archiveDate);
local (year = number (string.nthField (archiveDateString, "/", 1)));
local (month = number (string.nthField (archiveDateString, "/", 2)));
local (day = 1);
local (minute, second);
mindate = date.set (day, month, year, 0, 0, 0);
maxdate = date.set (day, month, year, 23, 59, 59);
maxdate = date.lastOfMonth (maxdate);
date.get (maxdate, @day, @month, @year, @hour, @minute, @second);
maxdate = date.set (day, month, year, 23, 59, 59)};
if flWeeklyArchive {
local (archiveDateString = pta^.archiveDate);
local (year = number (string.nthField (archiveDateString, "/", 1)));
local (month = number (string.nthField (archiveDateString, "/", 2)));
local (day = string.nthField (archiveDateString, "/", 3));
local (minute, second);
mindate = date.set (day, month, year, 0, 0, 0);
maxdate = date.set (day, month, year, 23, 59, 59);
maxdate = date.nextWeek (maxdate);
maxdate = date.yesterday (maxdate);
date.get (maxdate, @day, @month, @year, @hour, @minute, @second);
maxdate = date.set (day, month, year, 23, 59, 59)};
return (html.processMacros (radio.weblog.render (adrblog, daytemplate, itemtemplate, catname, maxDate:maxDate, minDate:minDate), false, adrPageTable:pta))}
<<return (radio.weblog.render (adrblog, daytemplate, itemtemplate, catname, maxDate:maxDate, minDate:minDate))
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.