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

List of threads on home page

Quote Reply
List of threads on home page
Is it possible to put a list of say the 5 most recent threads in a forum on the home page?
Quote Reply
Re: [hunthost] List of threads on home page In reply to
Well I figured out how to do this using ssi and making a separate template for forum view.

What I can't figure out is how to restrict the:
Code:
<%post_message%>

to x number of characters so the whole post is not displayed on the home page, but only the first bit.

Any ideas?
Quote Reply
Re: [hunthost] List of threads on home page In reply to
Include this bit of perl:

$message = substr($message,0,50);

$message being whatever variable your message is, and 50 being how many characters to chop it off at.


Realiiity.com Forums
Quote Reply
Re: [ellipsiiis] List of threads on home page In reply to
I created a global called:

chop_message

and filled it with:

sub {
$post_message = substr($post_message,0,50);
}

Then I put the following in my template:

<div>
<%loop post_loop%>
.......
.......
<%post_subject%>
.......
.......
<%chop_message%>
<%post_message%>
.......
.......
<%endloop%>
</div>

And I get the following out put:

Unable to compile 'chop_message':




Do you have any suggetions for what I might be doing wrong?

Last edited by:

hunthost: May 23, 2002, 6:07 PM
Quote Reply
Re: [hunthost] List of threads on home page In reply to
You would need something like:
Code:
sub {
my $post_message = shift;
return substr($post_message,0,50);
}
and then call it as <%chop_message($post_message)%> in the template.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [hunthost] List of threads on home page In reply to
Hunthost,

Can you share with the other novices out here what you did?

What does your template look like?

What is your SSI statement to only grab the last 5?



Thanks!
Quote Reply
Re: [shiner] List of threads on home page In reply to
Sure.

I created a separate template set so I could call it from the url, say: new_set.

then in the view_forum template for that set I deleted the enitire template and insterted something like:

<%post_loop%>
<a href="#"><%post_subject%></a>
<%post_loop%>

of course you will want to use formating appropriat to your site. In my instance I used block level CSS2, but you could use tables or what not too.

if you want to add the body of the post then you would add some thing like:

<%post_loop%>
<a href="#"><%post_subject%></a>
<p><%post_message%></p>
<%post_loop%>

I didn't end up shortening the message becaue I had to, in the end, write my own database calls to achive the controll I wanted.

however for those areas that I did use the template set I would call the forum with the folowing PHP include:

<?php include("http://www.gforum-url-goes-here.com/cgi-bin/gforum.cgi?forum=XX;t=new_set;mh=YY"); ?>

where XX = the forum id number
and YY = the number of threads to return form the fourm.

does that help?
Quote Reply
Re: [hunthost] List of threads on home page In reply to
Yes,

Actually - I have been pluggin away at this and learning a lot in the process.

Using the mod to find the newest user as my guide, I have developed a solution that works for me.

I have put my solution in the thread for NEWEST POST - since this thread was intended for newest 5 and I have been working in parallel paths.

http://www.gossamer-threads.com/...;;page=unread#unread