Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Code for Latest Posts on home page

Quote Reply
Code for Latest Posts on home page
Hi,
I have added here the code for creating a drop list on the main page that gives you access to the latest posts (by using the search function).

First you can add this to the at the top of your html page (generally between <head> and </head> although you can paste it just above the drop list in your page):

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Alex Tu <boudha1@hotmail.com> -->
<!-- Web Site: http://www.geocities.com/MadisonAvenue/4368 -->
<!-- Begin
function formHandler(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}
// End -->
</SCRIPT>

Then in the page where you want the drop list to appear you add this,

<b>You can choose in the drop list below to see the latest messages in the forum :</b>
</center><form name="form">
<SELECT NAME="site" size=1 class="button" onChange="javascript:formHandler()">
<OPTION VALUE="">Choose from this list
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=last&search_user_username=&mh=25">Since your last visit
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=24h&search_user_username=&mh=25">24 hours
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=3d&search_user_username=&mh=25">3 days
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=1w&search_user_username=&mh=25">1 week
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=2w&search_user_username=&mh=25">2 weeks
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=3w&search_user_username=&mh=25">3 weeks
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=1m&search_user_username=&mh=25">1 month
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=3m&search_user_username=&mh=25">3 months
</SELECT></center>


This by the way could be used for a French version,

<b>Vous pouvez choisir ci-dessous dans la liste déroulante pour voir les derniers messages dans les forums:</b>
<center><form name="form">
<SELECT NAME="site" size=1 class="button" onChange="javascript:formHandler()">
<OPTION VALUE="">Choisir dans cette liste
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=last&search_user_username=&mh=25">Depuis votre dernière visite
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=24h&search_user_username=&mh=25">24 heures
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=3d&search_user_username=&mh=25">3 jours
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=1w&search_user_username=&mh=25">1 semaine
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=2w&search_user_username=&mh=25">2 semaines
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=3w&search_user_username=&mh=25">3 semaines
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=1m&search_user_username=&mh=25">1 mois
<OPTION VALUE="gforum.cgi?do=search_results&search_forum=all&search_string=&search_type=AND&search_fields=sb&search_time=3m&search_user_username=&mh=25">3 mois
</SELECT></center>

It works OK on my forum and while I'm having a hard time understanding how to get the 5 latest messages print (depending on the user's access rights) on the home page this works OK.

John
Significant Media
Quote Reply
Re: [Jag] Code for Latest Posts on home page In reply to
Excellent Jag !!!!!!! I'm adding the code to my site right now :)

Thanx!




http://www.webconferencia.net/
Quote Reply
Re: [webconferencia] Code for Latest Posts on home page In reply to
Works great! You are a usability genius.
Quote Reply
Re: [Jag] Code for Latest Posts on home page In reply to
Jag,

I love this. Thanks a million. I made a Quick Seach menubar and added some user-defined search terms as well. Again thanks.

New question. Is there a link (like the ones here) that can be built that will result threads the users started? I know you can get all posts (new threads & replys) with a search by user, but I was hoping to make a My Threads link for users. Any idea on this?

Thanks!

Dave
Quote Reply
Re: [bretzke] Code for Latest Posts on home page In reply to
I'm not sure I understand the difference. Do you mean you want to see posts/ a discussion started by a user but not posts in response to a discussion started by another user ?

John
Significant Media
Quote Reply
Re: [Jag] Code for Latest Posts on home page In reply to
Yes, that is correct. Links to message threads started by the user, but not message replies posted by the user.

db