Summary: Talk page for BlogWithPageList.
Maintainer: MarcioRPS
Users: (View? / Edit)

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


(Moved from its own page)

If you use the blog with page list recipe you might want to use the following to easily create new blog entries. It will add the directive (:newdateform:) that will be replaced by a form with year, month and day select box. This is a Ugly Hack, I think.

Markup('newdateform', '>links',
##NewDateForm() returns a form to creating a new date
function NewDateForm() {
$formOut = '<form action="" method="post" name="Data" id="Data">
<p><input type="text" name="iTitulo" id="iTitulo" size="40" maxlength="60" /></p>
    <select name="iDia" id="iDia">
      <option value="01" selected>01</option>
      <option value="02">02</option>
      <option value="03">03</option>
      <option value="04">04</option>
      <option value="05">05</option>
      <option value="06">06</option>
      <option value="07">07</option>
      <option value="08">08</option>
      <option value="09">09</option>
      <option value="10">10</option>
      <option value="11">11</option>
      <option value="12">12</option>
      <option value="13">13</option>
      <option value="14">14</option>
      <option value="15">15</option>
      <option value="16">16</option>
      <option value="17">17</option>
      <option value="18">18</option>
      <option value="19">19</option>
      <option value="20">20</option>
      <option value="21">21</option>
      <option value="22">22</option>
      <option value="23">23</option>
      <option value="24">24</option>
      <option value="25">25</option>
      <option value="26">26</option>
      <option value="27">27</option>
      <option value="28">28</option>
      <option value="29">29</option>
      <option value="30">30</option>
      <option value="31">31</option>
    <select name="iMes" id="iMes">
      <option value="01" selected>Janeiro</option>
      <option value="02">Fevereiro</option>
      <option value="03">Mar&ccedil;o</option>
      <option value="04">Abril</option>
      <option value="05">Maio</option>
      <option value="06">Junho</option>
      <option value="07">Julho</option>
      <option value="08">Agosto</option>
      <option value="09">Setembro</option>
      <option value="10">Outubro</option>
      <option value="11">Novembro</option>
      <option value="12">Dezembro</option>
    <input name="iAno" type="text" id="iAno" value="2005" size="6"> 
    <input name="iHora" type="text" id="iHora" value="12" size="4"> : 
<input name="iMin" type="text" id="iMin" value="00" size="4"></p>
	<input name="vai" type="button" id="vai" value="Vai!"
	onclick="mF = document.getElementById( \'Data\' );
	mString = document.location.href.replace(/[^.\/]+$/,
	document.location.href = mString;" >
return Keep($formOut);

It works fine for me too. It would be fine to have just a few lines of each page in the blog and a link to the page after these lines noe November 15, 2005, at 03:09

You could use PagelistTemplateSamples#teaser or make a modified fmt=#include by adding lines=5 to (:include {=$FullName} lines=5:) in the #include template section. - HansB January 03, 2006, at 04:25 PM

Using any other order-parameter to the pagelist than "name" or "-name" forces the pagelist algorithm to load each file. This might get a performance bottleneck if you are having a lot of blog entries. (I thought about using "order=-ctime" instead of having the date in the filename). - Balu

I've been thinking about how this setup could work with RSS to create a blog-like RSS feed. The closest thing to that available on your site, from what I can tell, would be /BlogPages/RecentChanges?action=rss. Obviously what's missing there is , usually the full text of the most recent 10 pages are included in blog rss feeds, and then of course you have enclosures and the like associated with podcasts. Cookbook:RSSImproved? is a beginning of this sort of thing, but sadly it hasn't been ported for 2.1.betawhatever yet--with feeds.php instead of rss.php. What seems to not be working, to me, is RSS feeds of category pages, archive pages, or indeed the main page Blog/Blog. It appears that included pages don't show up in RSS feeds. It seems like feeds.php is still in development so maybe it will all become clear in the future...? - JonHaupt

RSS feeds can be set up including pagelist parameters now. So you can use


to get a feed of the last 50 pages from group BlogPages in order of creation time.

you can also add feed links to all blog pages, so visitors with browsers like Firefox can click the rss feed symbol and add the blog pages to their bookmarks easily.

Add to config.php:

## add blog feed links to header
$group = FmtPageName('$Group', $pagename);
if ($group=='Blog' || $group=='BlogPages' || $group=='BlogComments') {
  $HTMLHeaderFmt['blogrsslink'] =
    "\n <link rel='alternate' title='\$WikiTitle Blog RSS Feed'
      type='application/rss+xml' />\n  ";
  $HTMLHeaderFmt['blogatomlink'] =
    "<link rel='alternate' title='\$WikiTitle Blog Atom Feed'
      type='application/atom+xml' />\n  ";

Of course to have rss output it would also need to have pmwiki's rss feed enabled with:

# add rss feed supply capability
if ($action == 'rss' || $action == 'atom') {
     @include_once("$FarmD/scripts/feeds.php"); }


Following HansB's idea of the page variable, I did come up with this:

function ReadDateFromName ( $dc ) {
	global $TimeFmt;
	$dc = preg_replace("/(^|\.)([-\\d]*)/", '$2', $dc);
	$dc = preg_replace("/-/", '', $dc);
	$dc = $dc . substr("20051002093000", strlen($dc));
	return '(' . strftime($TimeFmt,
		mktime(substr($dc, 8, 2),
		substr($dc, 10, 2),
		substr($dc, 12, 2),
		substr($dc, 4, 2),
		substr($dc, 6, 2),
		substr($dc, 0, 4))) . ') ';
# add page variable {$DateOnName}, using global date fmt
$FmtPV['$DateOnName'] = 'ReadDateFromName ( $pagename )';

What this does is: it makes a pagevariable {$DateOnName} which is replaced by the date referenced in the name of the page, but formated following the sitewide $TimeFmt formating of dates (that is, the same that goes on RecentChanges pages and stuff...) MarcioRPS

Talk page for the BlogWithPageList recipe (users?).