[pmwiki-users] Blog, multiple entries per day / Blogging support

Hans hans.bracker at googlemail.com
Tue Aug 22 07:17:56 CDT 2006

> Which reminds me of my unanswered question in
> http://pmichaud.com/pipermail/pmwiki-users/2006-July/029610.html

>(:pagelist group=Blog fmt=#blog count=10 order=-ctime list=normal:)
>The local template for this list by now looks like:
>(:include {=$FullName}##readmore:)
>So the page only gets included up to [[#readmore]]
>But how would I create the link to the #readmore anchor (only if it
>exists in the included page of course)?
>1) Is there a way to create it in the blog pagelist template only if
>  the include stopped including at the anchor?

You may the following, but pagelist formatting is a tricky beast!


(:include {=$FullName}##readmore:)
(:if eq 1 {{=$FullName}$ReadMore}:)[[{=$FullName}|read more]](:if:)


you need the conditional extension installed to do the eq comparison.

and define in your blog script a page variable:

# add page variable {$ReadMore},
$FmtPV['$ReadMore'] = 'StringCount($pn,"[[#readmore]]")';

now I was lazy and used the StringCount function included
in commentboxplus, maybe ther eis a better way with  abetter function.

function StringCount($pagename,$find) {
   $page = ReadPage($pagename, READPAGE_CURRENT);
   $n = substr_count($page['text'], $find);
   if ($n==0) return '';  #suppressing 0
   return $n;

then in the page I used as anchor:


So it sets the anchor, plus a page variable, hidden as a comment.
The page variable is simply 1, and the condition in the fmt template
checks this.
The pagevariable could return not 1, but the anchor itself, but I
could not get the conditional to check against the anchor string.

You can check page variables with conditionals in the the pagelist fmt template,
but you can't check existence of strings in the text directly.

Hope this helps, and good luck!
(I felt it was needed to twist the conditional inside pagelist)


More information about the pmwiki-users mailing list