Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Re: [webslicer] Hot Threads List...

Quote Reply
Re: [webslicer] Hot Threads List... In reply to
Here goes. First, you'll need to scrub some of the styles, tables, etc. in the attached templates, sorry (but hopefully they'll get you started)! Once you do that, create a new template directory and load the attached templates into them.

Create this global (which I got from somewhere here a long time ago):
Code:
sub { my $tags = shift;
my $post_db = $DB->table ('Post');
$post_db->select_options ('WHERE post_root_id=0', 'ORDER BY post_time DESC', 'LIMIT 10');
my $sth = $post_db->select;
my @output;
while (my $post = $sth->fetchrow_hashref) { push @output, $post;
} return { post_loop => \@output };
}

I called it hot_threads; if you change the name, change it in the attached category_list.html. What it does in category_list.html is bring up a list of the linked subject lines of your ten most recent threads (change LIMIT to your tastes). You could also use it to add "descriptions" of the threads, i.e., the first X characters of the first post by creating a separate global called html_strip (a sample is attached) and then wrap the post_message variable in category_list.html with it like this:

Code:
<%html_strip($post_message)%>

It's longer than it should be for an SSI, but I'm also using it to strip out certain characters for generating an RSS feed (the attached version calls up to the first 200 characters). To limit the size of the subject lines, I created a global like this:

Code:
sub {
my $post_subject = shift;
return substr($post_subject,0,60);
}

where "60" is the number of characters you want - and wrap post_subject with it like this:

Code:
<%antisaklad($post_subject)%>

(in honor of a user who was forever writing subject lines as long as your average romance novel).

To actually call all this stuff via SSIs:

Create an SSI pointing at /cgi-bin/forum/gforum.cgi?t=ssi (where "ssi" is the name of your SSI-template directory) to bring up the ten most recent threads (the attached template also has a similar block to call up the ten most posted-to threads; feel free to delete).

If you want to call up the most recently commented-on threads in a particular forum, create an SSI for /cgi-bin/forum/gforum.cgi?forum=24;t=ssi - swapping in the ID number of the actual forum you pointed to.

We're a newspaper, so I also created similar SSIs to link articles to individual comments on them; if you want those, let me know.

Last edited by:

agaffin: Jun 22, 2005, 10:40 AM
Subject Author Views Date
Thread Hot Threads List... SeanP 6692 Feb 18, 2005, 11:51 AM
Thread Re: [SeanP] Hot Threads List...
SandraR 6464 Apr 14, 2005, 2:58 PM
Post Post deleted by SeanP
SeanP 6466 Apr 15, 2005, 12:37 PM
Thread Re: [SandraR] Hot Threads List...
webslicer 6454 Apr 19, 2005, 8:33 PM
Thread Re: [webslicer] Hot Threads List...
agaffin 6336 Jun 21, 2005, 11:55 AM
Thread Re: [agaffin] Hot Threads List...
webslicer 6371 Jun 22, 2005, 1:05 AM
Thread Re: [webslicer] Hot Threads List...
agaffin 6343 Jun 22, 2005, 10:20 AM
Thread Re: [agaffin] Hot Threads List...
webslicer 6268 Sep 9, 2005, 5:44 AM
Post Re: [webslicer] Hot Threads List...
Jobu 6003 Aug 25, 2006, 7:37 AM
Thread Re: [agaffin] Hot Threads List...
Jobu 5960 Sep 2, 2006, 6:56 AM
Thread Re: [Jobu] Hot Threads List...
tandat 5958 Sep 2, 2006, 7:58 AM
Post Re: [tandat] Hot Threads List...
Jobu 6003 Sep 2, 2006, 7:59 AM