[pmwiki-users] BlogSimple2 - for different users

Jon Haupt jhaupt at gmail.com
Tue Mar 6 09:13:14 CST 2007


On 3/6/07, Hans <design5 at softflow.co.uk> wrote:
> Monday, March 5, 2007, 10:58:19 PM, Hans wrote:
>
> > Thinking a bit more about this, you could try the following
> > (but make sure to test commenting first).
> >.....
>
> There were anumber of mistakes in the code. here is the corrected
> version:
>
> Thinking a bit more about this, you could try the following
> (but make sure to test commenting first).
>
> On a blog page set a page text variable {$:Blogauthor}
> Blogauthor: Fred   (for instance)
> or hidden:
> (:Blogauthor:Fred:)
> This is instead of (:Blog:1:) from BlogSimple2 recipe.
> Now we have a page text variable blogauthor with the author name.
>
> To list the blog pages for author Fred you can use
> (:pagelist $:Blogauthor=Fred list=blog order=-ctime fmt=#recentblog count=15:)
>
> Define Site.AllGroupFooter in config.php:
>
> $GroupFooterFmt =
>   '(:nl:)(:include $SiteGroup.AllGroupFooter:)'
>   .'(:nl:)(:include $Group.GroupFooter:)';
>
> Now the commentboxplus code for Site.AllGroupFooter:
>
> This makes sure to put  a comment box on pages which got a Blogauthor
> page text variable. The conditional test checks if a page text
> variable Blogauthor is present.
>
> (:if !equal {*$:Blogauthor} "":)
> ----
> (:div2 class=blogpost-comments:)
> (:if expr exists PostComments.{*$Group}-{*$Name} && !equal {*$:Blogauthor} "":)
> !!![[#comments]]{PostComments.{*$Group}-{*$Name}$PostCount}
> Comments:(:if !equal {*$:Blogauthor} "":)
> (:include PostComments.{*$Group}-{*$Name}:)
> !!! Add a Comment
> (:div3 class=blogpost-commentbox:)
> [[#commentbox]]
> (:commentboxchrono PostComments.{*$Group}-{*$Name}:)
> (:div3end:)
> (:div2end:)
> (:div1end:)
> (:div0end:)
> (:if:)
>
> Not sure why there are div1end and div0end, but I have not looked
> closely into Jon's BlogSimple2 code.
>
> I had to add the stars * to {*$:Blogauthor},
> and change the pagelist to read $:Blogauthor=Fred (no brackets here).
> I added the note about how to create Site.AllGroupFooter.
> I tested it briefly.
> Hope this helps.
> It should perhaps go onto another cookbook page for
> BlogSimpleForMultiUsers
>
> Hans
>

Cool.  In BlogSimple2, I had defined Site.SiteFooter instead of
AllGroupFooter.  Next time I update the code, I suppose I should use
the standard name.
BlogSimple2 adds divs in SiteHeader and SiteFooter so that the whole
entry including metadata can be styled.

I'll hasten to add, if you change the above, you'll also want to
change the contents of Site.SiteHeader (or change that to
AllGroupHeader) as well--because there is code there that is
conditional in the same way.  And--if you use a pagelist to display
recent blog entries, you will probably also want to change the
pagelist template Site.BlogListTemplates#recentblog in the same way.

Jon



More information about the pmwiki-users mailing list