http://www.blosxom.com/]] and [[(PmWiki:Profiles.)HansB]]/[[(PmWiki:Profiles.)MarcioRPS]]'s [[Cookbook:BlogWithPageList]] //:AUTHOR: Kimberly Kelly (Rot13ed); See also: [[(PmWiki:Profiles.)Feral]] //:VERSION: 0.1 -- Tue, 11 Apr 2006 18:45:11 PST //:ABOUT: This is a method to make a "PmWikiBlog" (that is to say a blog in PmWiki *wink*) using PmWiki itself to do 99% of the gruntwork, mostly pagelists. Categories, WikiStyles and a few custom PHP functions (defined in this file) are all that is needed; [[Cookbook:PmCalendar]] (with the included diff) can be used to generate a nice blog style calendar too! (I am rather pleased with how it turned out really) //:USAGE: in your ./local/config.php add: //*[@include_once("$FarmD/cookbook/feralblog.php"); // FeralBlog@] //:REQUIREMENTS: This has been developed and tested under PmWiki 2.1.3. However, It is unknown if this version (or later/earlier, etc.) is truly a requirement. // // //!Introduction //This is a basic method of setting PmWiki up to replicate a Blosxom style (very basic) blog with all the benefits that being a '''PmWikiBlog''' provides. // //!!Features //*Display is handled via pagelists and custom templates. //*New entries are provided via a template (and a cleaver method, @@?action=edit&template@@, of saying to use a template, I think) however one could just as easily create a form to make the new page, such as the style used in [[Cookbook:PITS]]. I have the aforementioned link in @@Blog.GroupHeader@@ (detailed below) //*PmWiki's category style is used. This presented method uses a special purpose category group (Called "''Blogory''" for lack of a better name *wink*) so as not to pollute the Wiki's categories with the blog related/specific categories. You can safely and easily not worry about this if you want one and only one category. (I personally have three, but never mind that *wink* ) //*Normal PmWiki formatting tricks are used, WikiStyles, etc. However, none of it is necessary, of course. //*I have provided support for a modified [[Cookbook:PmCalendar | PmCal]] (unified diffs below) for a calendar that allows navigation; Given that we display via pagelist we can specify what to show via a number of ways, such as the provided "[@?year=2006&month=4&day=9@]" style (with accompanying parse PHP function: @@blogcalparams()@@ ); Perhaps you would prefer a form to set the params... // // //!Each entry: //In the way that I use this each entry is a separate wiki page, however you can have a separate wiki page per day just as easily. // //With each page being an entry we can easily use a new page template to give us a skeleton of an entry. If you opt for one page per day I suggest a "fill in the form to make an entry" method and append the contents to the relevant page style. (At least, I am pretty sure that, as described, is possible.). // //!!WikiStyle for the entry's category line: //For convenience and consistency we create a default wikistyle for our entry's category line: //*[@%blogcategory%[--... :: [[{(:rospagename:)$PageUrl} | permanent link]]--]%%@] //What you want this to look like is, of course, your choice. //(:source lang=php :) $WikiStyle['blogcategory']['apply'] = 'block'; $WikiStyle['blogcategory']['background-color'] = 'mistyrose'; ////$WikiStyle['blogcategory']['background-color'] = 'antiquewhite'; $WikiStyle['blogcategory']['color'] = 'mediumvioletred'; ////$WikiStyle['blogcategory']['border'] = '1px solid magenta'; ////$WikiStyle['blogcategory']['border'] = '1px solid darkviolet'; $WikiStyle['blogcategory']['border'] = '1px solid firebrick'; ////$WikiStyle['blogcategory']['border'] = '1px solid lavender'; ////$WikiStyle['blogcategory']['padding'] = '2px'; $WikiStyle['blogcategory']['padding-right'] = '5px'; $WikiStyle['blogcategory']['text-align'] = 'right'; $WikiStyle['blogcategory']['font-style'] = 'italic'; //(:sourcend:) // // //!A function to present a pretty name from a timestamp only page name. //Given that I have my pages containing the timestamp only I wanted the pagelist to display a long date format which I find more readable. This function takes the page name and returns the long date format. Such as a page name of "@@200604090233AM@@" will return "@@April 09, 2006, at 02:33 AM@@" //*NOTE that we can also deal with a short date (no time) format also, such as: "@@20050307@@" returns "@@March 07, 2005@@" //*NOTE also that "@@2006-04-09-02-33-AM@@" and "@@2006_04_09_02_33_AM@@" style seperators are valid. //(:source lang=php :) $FmtPV['$BlogToLongDate'] = 'BlogToLongDate($pagename)'; function BlogToLongDate($which) { // {{{ if(preg_match("/([\d][\d][\d][\d])[-_]?([\d][\d])[-_]?([\d][\d])[-_]?([\d][\d])?[-_]?([\d][\d])?[-_]?(PM)?/ie",$which,$m) ) { // We have matched something like: @@200604090233AM@@, or "@@20050307@@". if($m[1]) { // Year (4 digit) $yy = $m[1]; } else { // preg_match above requies this?! return $tname; } if($m[2]) { // Month (2 digit) $mm = $m[2]; } else { // preg_match above requies this?! return $tname; } if($m[3]) { // Day (2 digit) $dd = $m[3]; } else { // preg_match above requies this?! return $tname; } if($m[4]) { // Optional Hour (2 digit) $hh = $m[4]; } else { $hh = 0; } if($m[5]) { // Optional Minute (2 digit) $min = $m[5]; } else { $min = 0; } if($m[6]) { // Optional "PM" marker (for the full time version this is presumed to be "AM" or "PM" but we only check if "PM" is present. if($hh) { $hh += 12; if($hh >= 24) { $hh-=12; } } } $tdate = mktime($hh,$min,0,$mm,$dd,$yy); if($hh) { // If we have an hour, I.e. long form... global $TimeFmt; $bmonth = strftime($TimeFmt,$tdate); } else { // Short form. $bmonth = strftime("%B %d, %Y",$tdate); } } else { // NO match. We have no idea what we were given so return it as it was given to us. return FmtPageName('$Namespaced', $which); } return $bmonth; } // }}} //(:sourcend:) // // //!Vars which are replaced each time a page is rendered. //Here are a few page vars which may be useful, Only "[@$blogcalparams@]" is required as it is the one which parses our URL parameters. //(:source lang=php :) $FmtPV['$Today'] = 'strftime("%A %d %B", time() )'; // Only used in Blog.GroupHeader by and large... ////$FmtPV['$BlogToday'] = 'strftime("%Y%m%d", time() )'; $FmtPV['$BlogTodayFull'] = 'strftime("%Y%m%d%H%M%p", time() )'; $FmtPV['$year'] = '\$_GET[\'year\']'; $FmtPV['$month'] = '\$_GET[\'month\']'; $FmtPV['$day'] = '\$_GET[\'day\']'; $FmtPV['$blogcalparams'] = 'blogcalparams()'; //(:sourcend:) // //@@blogcalparams()@@ will give us a nicely formated string if we are passed @@?year=@@ and optionally @@month=@@ and @@day=@@, such as: //*[@?year=2006&month=4&day=9@] for April 9th, 2006 -- returns "20060409*" //*[@?year=2006&month=4@] for April, 2006 -- returns "200604*" //*[@?year=2006@] for 2006 -- returns "2006*" //*NOTE: day without month is meaningless and ignored; //*NOTE: month and day are meaningless without year. //(:source:) function blogcalparams() { // {{{ // [Feral:080/06@10:06] If we have no year then there is nothing for us to do; // If we have no month we return $year* // If we have no day we return $year$month* // If we have year, month and day we return $year$month$day* if(isset($_GET['year']) ) { $year = $_GET['year']; } else { // If we have no year this the rest is not relevant. return ""; } if(isset($_GET['month']) ) { $month = $_GET['month']; } if(isset($_GET['day']) ) { $day = $_GET['day']; } if(!$month) { // If we do not have month return just the year portion. $tdate = mktime(0,0,0,1,1,$year); $bmonth = strftime("%Y",$tdate); return "$bmonth*"; } else if(!$day) { // If we do not have day return just the year+month portion. $tdate = mktime(0,0,0,$month,1,$year); $bmonth = strftime("%Y%m",$tdate); return "$bmonth*"; } else { // We have year, month and day so return year+month+day ;) $tdate = mktime(0,0,0,$month,$day,$year); $bmonth = strftime("%Y%m%d",$tdate); return "$bmonth*"; } } // }}} //(:sourcend:) // //This is really the magic of the whole mess. Now that PmWiki can deal with a wildcard for the group parameter of a PageList we can construct a string to function as our search parameter. This works because our page names are our timestamp such that "@@20060409*@@", "@@200604*@@" and "@@2006*@@" all match "200604090233AM". So if we are consistent with our naming scheme (let the automatically generated links in "[@Blog.GroupHeader@]" make the page names for you), we can easily list via year, month and day. (Technically hour/etc. also, but that is not implemented, etc.) // //I.e. //(:source:)[= //(:if !equal {$blogcalparams} "" :) //!Specific params: ''{$blogcalparams}'' //(:PageList group={$Group}.{$blogcalparams} fmt=#blogstyle3 list=normal order=-ctime :) //(:ifend:) //=] //If we have params, use them for the @@group=@@ param of PageList. // //More on this in the "[@Blog.Blog@]" section below. // // //!How to specify what to display //Now, thanks to [@$blogcalparams@] we can parse the URL params and consequently choose which parts of our blog to display but we have no way to easily pick something like "?year=2006&month=4&day=9". This is where our modified version (see the unified diffs below) of [[(Cookbook:)PmCalendar]] (Version: 1.0rc6) comes in, which does little more than add a @@bloglink@@ param, which will modify the output link style of the calendar. NOTE that with @@bloglink = true@@ the URLs that the calendar specifies will not change the current page only the parameters to the page. //*NOTE that I have not tested this with @@bloglink=true@@ with anything other than [@(:pmcal styles=PmCal-Mini includes=false bloglink=true :)@]. Given that I have change very little the other options '''should''' still work. I think we all know how that goes though! ;) // //However, even with this modified version of the ever so useful PmCal I find I still have to modify the URL line manually to find a particular date, however it is quite easy to get the bulk of the desired url. // //Eventually I would like to add a simply little form which uses 3 drop down combo boxes to specify the year, month and day. In @@Blog.GroupHeader@@ however this is not present as of yet. (Mostly because I find webforms intimidating, but never mind that :P ) // // //!Categories //!!Markup for a new Category (optional) //This will add a new markup ('''[@[[!!@]''' ''[@blogcategory@]'' '''[@]]@]''') that will easily allow us to use a different category than the default Category group. NOTE that this is totally ''(optional)''. //(:source:) ////Add markup for "[[!!BlogCategory]]" Markup('[[!!','<[[!','/\\[\\[!!(.*?)\\]\\]/e', "Keep(MakeLink(\$pagename,PSS('Blogory/$1'),NULL,'',\$GLOBALS['LinkCategoryFmt']),'L')"); //(:sourcend:) // //In my case I want my blog topics separate from the rest of the wiki. This has the side benefit of easily allowing us to use a pagelist with a custom format to list our blog categories. // // //!!Using a pagelist to list our categories //Our .NewPageTemplate contains these lines: //(:source:) //!!TODO:Preview and pick the Category links you like... //(:pagelist group=Blogory list=normal fmt=#blogorylist :) //---- //(:sourcend:) // //Which when previewed turns out to something like this: //(:source:) //!!TODO:Preview and pick the Category links you like... // //[[!!Accessory]], [[!!Blog]], [[!!Blogory]], [[!!Clothing]], [[!!Coat]], [[!!Food]], [[!!Misc]] //---- //(:sourcend:) // //This allows a method for us to pick and choose from all available pre-existing categories. (and keeps me from making redundant similar blog categories) // //NOTE: I have found that it is good practice to create a new category's page when you add it else I have this nasty tendency to forget about it as it will not who up on the pagelist until it exists. See the “[@Blogory.NewPageTemplate@]” section for the template I use. // // //!!A note regarding categories: //Given that this PmWikiBlog does not have nested categories we may need to change our thought process of where a blog entry belongs. For instance when I ported my Blosxom blog to this, I had to convert category trees to the equivalent PmWikiBlog idea. As it turns out this is relatively simple as, for instance, my Blosxom blog had an entry in the "@@/Clothing/Coat@@" category. Functionally this means the entry is in both @@Clothing@@ and @@Coat@@, and allows us to list this entry when viewing either the @@Clothing@@ and or @@Coat@@ lists. A simple addition of [@[[!!Clothing]], [[!!Coat]]@] was all that is needed to achieve this and I could list the entry Just as I had in my Blosxom blog. // //However, what I do not currently have is a nice at a glance method to see where an entry lies in the scheme of things. For instance my Blosxom blog entry had "[@Home / clothing / coat :: permanent link@]", where as in this FeralBlog I have "[@clothing, coat :: permanent link@]" which is not as implicit, however ultimately this allows much greater categorization. For instance such an entry about a coat can '''also''' be in say "@@cold_weather@@", "@@red_outfits@@" and "@@wanted@@". // //However, I do not yet have support for date delimiters, for instance all @@Coat@@ entries in @@2005@@. I believe PmWiki can do this without modification however that is a task for another day as it is past my bedtime and I want to get this posted tonight! {lol} (That is a smiley in my wiki by the by) // // //!Tricks... //!!FeralBlog Trick #1 //This is a quick and simple method to only use a new page template in certain circumstances, such as with "@@'''template'''@@" present on the URL line when we are editing, I.e. [@?action=edit&template@]. //(:source lang=php :) //Only base a new page off of a template if it is requested of us, such as with [@?action=edit&template@] if($action == 'edit' && isset($_GET['template']) ) { // {{{ $EditTemplatesFmt = '{$Group}.NewPageTemplate'; } // }}} //(:sourcend:) // //!!FeralBlog Trick #2 //This is little more than a way to only use a ROS pattern on certain pages, in this case '''NOT''' in a @@NewPageTemplate@@ page. //(:source lang=php :) //If we are NOT in a .NewPageTemplate$ //TO be clear, this means that these vars WILL NOT expand in say Blog.NewPageTemplate, but WILL in say Blog.200604090233AM. if(!preg_match('/\\.NewPageTemplate$/', $pagename)) { // {{{ $ROSPatterns["/\(:blogfulldate:\)/i"] = strftime("%A, %B %d, %Y, %H:%M:%p", time() ); //[[{(:rospagename:)$PageUrl} | permanent link]] -> [[{Blog.200604090233AM$PageUrl} | permanent link]] $ROSPatterns["/\(:rospagename:\)/i"] = '$pagename'; } // }}} //(:sourcend:) // // //!Pages of note: //!!Blog.GroupHeader: //(:source:)[= //(:pmcal styles=PmCal-Mini includes=false bloglink=true :) //It is currently: {$Today}[[<<]] //[@[@][[Blog/Blog]][@]@] Make a new [@[@][[Blog.{$BlogTodayFull}?action=edit&template|entry]][@]@]. See also [[Blogory/Blogory]]. //---- //=] //NOTE that the default PmCal does not have bloglink support; See the unified diffs below. // //!!Blog.GroupFooter: //(:source:)[= //---- //(:if !name blog :) //(:PageList link={$FullName} fmt=#blogorystyle list=normal order=-ctime :) //(:if name blog :) //NOTE that the Bloglist has been suppressed for this page. //(:ifend:) //=] //NOTE that we will not pagelist the backlinks on the main [@Blog.Blog@] page, as there is really no point. (The backlinks are good for cross-referencing entries, which has no meaning for the generic [@Blog.Blog@] page.) // //!!Blog.NewPageTemplate: //(:source:)[= //(:blogfulldate:): // // //!!TODO: Preview and pick the Category links you like... //(:pagelist group=Blogory list=normal fmt=#blogorylist :) //---- // //%blogcategory%[--... :: [[{(:rospagename:)$PageUrl} | permanent link]]--]%% //=] //You will want to customize this for your new entry template, of course. // //!! Blog.Blog: //(:source:)[= //(:if equal {$blogcalparams} "" :) //!10 most recent entries. //(:PageList group={$Group} fmt=#blogstyle3 list=normal count=10 order=-ctime :) //(:if !equal {$blogcalparams} "" :) //!Specific params: ''{$blogcalparams}'' //(:PageList group={$Group}.{$blogcalparams} fmt=#blogstyle3 list=normal order=-ctime :) //(:ifend:) //=] //Which is to say if we were not passed anything [@{$blogcalparams}@] is empty, then show the 10 most recent entries. Else, use [@{$blogcalparams}@] to limit our @@group=@@ param for pagelist. // //!!Fragments from [@Site.PageListTemplates@] //(:source:)[= //---- //!!!fmt=#blogorystyle //A blog style in a table, full include. // //[@ //[[#blogorystyle]] //(:if equal {<$Group}:) //(:table width=100% :)(:if:) //(:if equal {=$Group} Blogory:) //(:cellnr style="color:#FFFF00;background:#5E00C0;padding-left:5px" :)'''[+[[{=$FullName}]]+]''' //(:cellnr style="color:#FFFAF0;background:#483D8B;padding-left:5px" :) //(:PageList link={=$FullName} fmt=#blogstyle3 list=normal order=-ctime :) //(:ifend:) //(:if !equal {=$Group} Blogory:) //(:cellnr style="color:#F0FFFF;background:#8A2BE2;padding-left:5px" :)'''[+[[{=$FullName}|{=$BlogToLongDate}]]+]''' //(:cellnr style="color:#FFFAF0;background:#483D8B;padding-left:5px" :) //(:include {=$FullName} :) //(:ifend:) //(:if equal {>$Group}:) //(:tableend:)(:if:) //[[#blogorystyleend]] //@] // //---- //!!!fmt=#blogorylist // //A Blogory style listing [@[[!!name]], [[!!name]]@], etc. // //[@ //[[#blogorylist]] //(:if !equal {>$Group}:) //[@[[!!@]{=$Name}[@]], @](:if:) //(:if equal {>$Group}:) //[@[[!!@]{=$Name}[@]]@](:if:) //[[#blogorylist]] //@] // //---- //!!!fmt=#blogstyle3 //A blog style in a table, full include. // //[@ //[[#blogstyle3]] //(:if equal {<$Group}:) //(:table width=100% :)(:if:) //(:cellnr style="color:#F0FFFF;background:#8A2BE2;padding-left:5px" height=30px align=center :)'''[+++[[{=$FullName}|{=$BlogToLongDate}]]+++]''' //(:cellnr style="color:#FFFAF0;background:#483D8B;padding-left:5px" :) //(:include {=$FullName} :) //(:if equal {>$Group}:) //(:tableend:)(:if:) //[[#blogstyle3end]] //@] // //---- //=] // //!!Blogory.NewPageTemplate //Template for a new Blogory page. //(:source:)[= //{$FullName}, child of [[!!!Blogory]]. // //%color=lime font-style=italic%Describe me! //=] // //These, of course, can be customized in any way you like. // // //!Unified diffs for pmcal.php (Version: 1.0rc6 /w stopafter) //You want to apply either the short version (JUST bloglink) or the long version (bloglink AND long page name recognition) // //!! Short version (''bloglink'') //Version to ADD support for: //* @@bloglink@@ param to [@(:pmcal:)@] // //(:source lang=diff:)[= //--- pmcal_v1_0rc6.php //+++ C:\home\feral\feralwiki\cookbook\pmcal.php 2006-04-11 06:09:07.000000000 -0700 //@@ -420,12 +420,15 @@ // if (isset($_GET['weekstart'])) // $urladd.="&weekstart=".urlencode($_GET['weekstart']); // if (isset($_GET['zebra'])) // $urladd.="&zebra=".urlencode($_GET['zebra']); // $zebra = isset($_GET['zebra']) ? $_GET['zebra'] : $args['zebra']; // //+// { [Feral:080/06@12:17] SO: bloglink //+ $bloglink = isset($_GET['bloglink']) ? $_GET['bloglink'] : $args['bloglink']; //+// } EO: bloglink // // // Experimenting with CSS // // Styles can come out of the upload area for the group! // // // $first=1; //Set first style to the preferred. // if ($styles[0] != NULL) { //@@ -760,14 +763,23 @@ // if (!PageExists($pmcalpagename)) { // // Bizarre hack added due to PmWiki change. // $dn=$dn . " pmcalcreatetextlink"; // } // $out.=sprintf("(:$ctype class='%s' height=80px :)\n",$cl); // $out.="%class='$dn'%"; //- $out.=sprintf("[[$group.%s%02d%02d?year=%s&month=%s&day=%s%s|%s]]\n", //- $year,$month,$iday,$year,$month,$iday,$urladd,$iday); //+// { [Feral:080/06@12:17] SO: bloglink //+// Original Line: //+// $out.=sprintf("[[$group.%s%02d%02d?year=%s&month=%s&day=%s%s|%s]]\n", //+// $year,$month,$iday,$year,$month,$iday,$urladd,$iday); //+// My modifications: //+ if($bloglink && FindBlogPage($pmcalpagename) ) { //+ $out.=sprintf("[[$group?year=%s&month=%s&day=%s%s|%s]]\n", $year,$month,$iday,$urladd,$iday); //+ } else { //+ $out.=sprintf("[[$group.%s%02d%02d?year=%s&month=%s&day=%s%s|%s]]\n", $year,$month,$iday,$year,$month,$iday,$urladd,$iday); //+ } //+// } EO: bloglink // if ($includes != 'false' && PageExists($pmcalpagename)) { // $MaxIncludes++; // $out.=sprintf("\\\\\n\n(:include %s %s=%s:)\n",$pmcalpagename,$parasorlines,$normallinesparas); // } // } else if ($caltype == "text") { // if (! $skip && PageExists($pmcalpagename)) { //=] // // //!! Long version (''bloglink'' '''AND''' ''FindBlogPage'') //Version to ADD support for: //* bloglink param to [@(:pmcal:)@] //*''@@FindBlogPage()@@'' -- So pages with names such as "200604090233AM" will show up as having an entry. (Useful if you use the long date/time page name style.) // //(:source lang=diff:)[= //--- pmcal_v1_0rc6.php //+++ C:\home\feral\feralwiki\cookbook\pmcal.php 2006-04-11 06:02:40.000000000 -0700 //@@ -420,12 +420,15 @@ // if (isset($_GET['weekstart'])) // $urladd.="&weekstart=".urlencode($_GET['weekstart']); // if (isset($_GET['zebra'])) // $urladd.="&zebra=".urlencode($_GET['zebra']); // $zebra = isset($_GET['zebra']) ? $_GET['zebra'] : $args['zebra']; // //+// { [Feral:080/06@12:17] SO: bloglink //+ $bloglink = isset($_GET['bloglink']) ? $_GET['bloglink'] : $args['bloglink']; //+// } EO: bloglink // // // Experimenting with CSS // // Styles can come out of the upload area for the group! // // // $first=1; //Set first style to the preferred. // if ($styles[0] != NULL) { //@@ -669,16 +672,32 @@ // $out.="(:table "; // $out.="class='$cl' "; // $out.="border=1 cellspacing=0 cellpadding=3 width=100%:)\n"; // $out.="(:cellnr class='pmcalmonthtitle' colspan=7:)\n"; // // Large one liner broken up into multiple appends // $out.="%class='pmcalnavlinks pmcalnavlinksprev'%"; //- $out.="[[$group?month=$prevmonth&day=1&year=$prevyear$urladd|$navprevout]] %%"; //- $out.="[[$group?month=$month&day=$day&year=$year$urladd|$mt]]"; //- $out.="%class='pmcalnavlinks pmcalnavlinksnext'%"; //- $out.=" [[$group?month=$nextmonth&day=1&year=$nextyear$urladd|$navnextout]]%%\n"; //+// { [Feral:080/06@12:17] SO: bloglink //+// Original Lines: //+// $out.="[[$group?month=$prevmonth&day=1&year=$prevyear$urladd|$navprevout]] %%"; //+// $out.="[[$group?month=$month&day=$day&year=$year$urladd|$mt]]"; //+// $out.="%class='pmcalnavlinks pmcalnavlinksnext'%"; //+// $out.=" [[$group?month=$nextmonth&day=1&year=$nextyear$urladd|$navnextout]]%%\n"; //+// My modifications: //+ if($bloglink) { //+ $out.="[[$group?month=$prevmonth&year=$prevyear$urladd|$navprevout]] %%"; //+ $out.="[[$group?month=$month&year=$year$urladd|$mt]]"; //+ $out.="%class='pmcalnavlinks pmcalnavlinksnext'%"; //+ $out.=" [[$group?month=$nextmonth&year=$nextyear$urladd|$navnextout]]%%\n"; //+ //+ } else { //+ $out.="[[$group?month=$prevmonth&day=1&year=$prevyear$urladd|$navprevout]] %%"; //+ $out.="[[$group?month=$month&day=$day&year=$year$urladd|$mt]]"; //+ $out.="%class='pmcalnavlinks pmcalnavlinksnext'%"; //+ $out.=" [[$group?month=$nextmonth&day=1&year=$nextyear$urladd|$navnextout]]%%\n"; //+ } //+// } EO: bloglink // // // Output days of week headings // // // $ctype="cellnr"; // for ($i=0; $i < 7; $i++) { // $out.="(:$ctype "; //@@ -760,14 +779,23 @@ // if (!PageExists($pmcalpagename)) { // // Bizarre hack added due to PmWiki change. // $dn=$dn . " pmcalcreatetextlink"; // } // $out.=sprintf("(:$ctype class='%s' height=80px :)\n",$cl); // $out.="%class='$dn'%"; //- $out.=sprintf("[[$group.%s%02d%02d?year=%s&month=%s&day=%s%s|%s]]\n", //- $year,$month,$iday,$year,$month,$iday,$urladd,$iday); //+// { [Feral:080/06@12:17] SO: bloglink //+// Original Line: //+// $out.=sprintf("[[$group.%s%02d%02d?year=%s&month=%s&day=%s%s|%s]]\n", //+// $year,$month,$iday,$year,$month,$iday,$urladd,$iday); //+// My modifications: //+ if($bloglink && FindBlogPage($pmcalpagename) ) { //+ $out.=sprintf("[[$group?year=%s&month=%s&day=%s%s|%s]]\n", $year,$month,$iday,$urladd,$iday); //+ } else { //+ $out.=sprintf("[[$group.%s%02d%02d?year=%s&month=%s&day=%s%s|%s]]\n", $year,$month,$iday,$year,$month,$iday,$urladd,$iday); //+ } //+// } EO: bloglink // if ($includes != 'false' && PageExists($pmcalpagename)) { // $MaxIncludes++; // $out.=sprintf("\\\\\n\n(:include %s %s=%s:)\n",$pmcalpagename,$parasorlines,$normallinesparas); // } // } else if ($caltype == "text") { // if (! $skip && PageExists($pmcalpagename)) { //@@ -917,7 +945,65 @@ // $year=$nextyear; // $month=$nextmonth; // } // } //end of month loop // PRR(); return $out; // } //+ //+ //+// [Feral:084/06@16:51] Based on PageIndexGrep from pagelist.php Copyright 2004-2006 Patrick R. Michaud (pmichaud@pobox.com) //+// [Feral:084/06@17:13] NOTE: this could be faster in that we call this for every day, which is **silly**! //+// Really we should do this and fetch the lines with $group.$year$month at the start of each calendar. //+// [Feral:101/06@05:53] However, it does seem fast enough like this (I suspect the $PageIndexFile ends up in the disk cashe rather quickly so if it is not broke, lets keep it simple (= //+ //+function FindBlogPage($pagePattern) //+{ // {{{ //+ $retval = false; //+ //+ global $PageIndexFile; //+ if (!$PageIndexFile) //+ { //+ return false; //+ } //+ //+ StopWatch('FindBlogPage begin'); //+ //+ $fp = @fopen($PageIndexFile, 'r'); //+ if ($fp) //+ { //+ //+ while (!feof($fp)) //+ { //+ //+ $line = fgets($fp, 4096); //+ //+ while (substr($line, -1, 1) != "\n" && !feof($fp)) //+ { //+ $line .= fgets($fp, 4096); //+ } //+ //+ $i = strpos($line, ':'); //+ if (!$i) //+ { //+ continue; //+ } //+ //+ if(preg_match("/^$pagePattern/", $line, $match)) //+ { //+ $retval = true; //+ break; //+ } //+ //+ } //+ fclose($fp); //+ } //+ else //+ { //+ return false; //+ } //+ //+ StopWatch('FindBlogPage end'); //+ //+ return $retval; //+} // }}} //+ // ? > //=] //NOTE I had to tweak the above end marker so the file version of this would not prematurely terminate. (Silly PHP!) // //All in all this is kind of a large mess and I am sorry my descriptions and coherence is lacking. Hopefully there is enough information so this mess is of use to someone. I will answer any questions I can regarding. // //EOF