The Toolkit for Online Communities
18813 Community Members, 0 members online, 2153 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Q&A : Including latest blog on front page : One Message

Forum OpenACS Q&A: Re: Including latest blog on front page

Posted by Lars Pind on
Nope, not out of the box.

If you look at the documentation, you'll find instructions on how to include the whole blog. Perhaps you can make simple modifications to suit your needs?


(click 'download')


Posted by James Harris on
Thanks Lars, I'll try to have a look at it over the weekend.

Another question I have is whether it is possible to control the number of blog entries that show up on the blog home page.  It appears that they are all displayed which can obviously lead to long pages.  It would be cool to have a parameter which controls the maximum number displayed on the home page.

Posted by Jarkko Laine on

They are not all displayed. Can't remember the exact amount (or time span) of entries shown, though. I guess both the blogger home page and includable snippet use same proc to get the entries, so it shouldn't be too hard to put there a parameter for maximum number of entries shown.

Posted by Vinod Kurup on
The default is to show 30 days worth of posts. I hacked mine to show a certain number of posts, based on a parameter. If the parameter is set to 0, then it's ignored and 30 days of posts are shown. It's currently PG-only cuz it uses the LIMIT clause, but here it is in case you want it as a base to start from:
Index: lars-blogger.info
RCS file: /cvsroot/openacs-4/packages/lars-blogger/lars-blogger.info,v
retrieving revision
diff -u -b -B -r1.8.2.10 lars-blogger.info
--- lars-blogger.info	1 Jul 2003 13:28:25 -0000
+++ lars-blogger.info	10 Jul 2003 02:09:27 -0000
@@ -24,6 +24,7 @@
+            <parameter datatype="number"  min_n_values="1"  max_n_values="1"  name="NumPostsOnFrontPage"  default="0" description="How many posts do you want on your front page? Enter 0 to show the last 30 days of posts."/>
             <parameter datatype="number"  min_n_values="1"  max_n_values="1"  name="package_rss_feed_p"  default="1" description="Should we build an RSS feed for this instance." section_name="rss"/>
             <parameter datatype="number"  min_n_values="1"  max_n_values="1"  name="user_rss_feed_p"  default="0" description="Should we build an RSS feed for each user." section_name="rss"/>
             <parameter datatype="string"  min_n_values="1"  max_n_values="1"  name="rss_file_name"  default="rss.xml" description="What name should we advertise the RSS feed under, relative to the blog mount point. Leave blank if no RSS feed." section_name="rss"/>
Index: www/blog-postgresql.xql
RCS file: /cvsroot/openacs-4/packages/lars-blogger/www/blog-postgresql.xql,v
retrieving revision
diff -u -b -B -r1.3.2.4 blog-postgresql.xql
--- www/blog-postgresql.xql	13 Jun 2003 09:15:01 -0000
+++ www/blog-postgresql.xql	10 Jul 2003 02:09:27 -0000
@@ -42,6 +42,7 @@
 		    and    draft_p = 'f'
 		    and    deleted_p = 'f'
 		    order  by entry_date desc, posted_date desc
+		    $limit_clause
Index: www/blog.tcl
RCS file: /cvsroot/openacs-4/packages/lars-blogger/www/blog.tcl,v
retrieving revision
diff -u -b -B -r1.8.2.6 blog.tcl
--- www/blog.tcl	1 Jul 2003 13:28:26 -0000
+++ www/blog.tcl	10 Jul 2003 02:09:27 -0000
@@ -26,14 +26,30 @@
 if { ![info exists type] } {
     set type "current"
+    # does user want 30 days of posts or a certain number of posts
+    set num_posts [parameter::get \
+		       -package_id $package_id \
+		       -parameter NumPostsOnFrontPage \
+		       -default 0]
+    if {![string equal $num_posts 0]} {
+        set type "number_posts"
+    }
 switch -exact $type {
     archive {
         set date_clause "[db_map date_clause_archive]"
+        set limit_clause ""
+    }
+    number_posts {
+        set date_clause "1=1"
+        set limit_clause "limit $num_posts"
     default {
         set date_clause "[db_map date_clause_default]"
+        set limit_clause ""