|
Ok, I like the event/calendar feature of the forum, but wanted users to have an easier way to find and promote their events, rather than scrolling through posts or pages of a calendar.
The mod creates a way for you to have a list of your events in a div on any other page of your site. Check out my main page http://www.swvhc.com - www.swvhc.com , you'll see a frame (css) on the right side that has a list of events, actively generated from the database, filtered to start with current date (no old events) and run one year. Hyperlinks take you to the appriate forum.
As a side note, if you look at my forum events/calendar submissions you'll see it's been modified as well, different buttons to add event, removed the end date, etc...
Anyways, The mod started with the rss file for calendar, but is a lot trimmer.
Show below: the html used to include the set of links & dates, and the file calendarbox.asp which generates the list.
html:
<div <!-- #include file="forum/calendarbox.asp" --> </div>
You can view the source from my homepage to see all the css used to format
(btw, the site is 100% css, can't believe I'm free of tables :) )
Here is the file calendarbox.asp
<!-- #include file="database/database_connection.asp" --> <!-- #include file="language_files/language_file_inc.asp" --> <!-- #include file="functions/functions_common.asp" --> <!-- #include file="includes/setup_options_inc.asp" --> <!-- #include file="includes/global_variables_inc.asp" -->
<% 'Open database connection and load configuration Call openDatabase(strCon) Call getForumConfigurationData()
'Declare variables Dim sarryRssTopics 'Holds the RSS Feed recordset Dim intCurrentRecord 'Holds the current record in the array
Dim lngTopicID 'Holds the topic ID Dim lngMessageID 'Holds the message ID Dim strSubject 'Holds the subject Dim dtmEventMonth 'Holds the event month Dim dtmEventDay 'Holds the event day Dim dtmEventYear 'Holds the event year
Dim dtmDbStartDate 'Holds the database search start date Dim dtmDbEndDate 'Holds the database search end date
dtmDbStartDate = internationalDateTime(Now()) dtmDbEndDate = internationalDateTime(DateAdd("yyyy", 1, Now()))
'SQL Server doesn't like ISO dates with '-' in them, so remove the '-' part If strDatabaseType = "SQLServer" Then dtmDbStartDate = Replace(dtmDbStartDate, "-", "", 1, -1, 1) dtmDbEndDate = Replace(dtmDbEndDate, "-", "", 1, -1, 1) End If
'Place the date in SQL safe # or ' If strDatabaseType = "Access" Then dtmDbStartDate = "#" & dtmDbStartDate & "#" dtmDbEndDate = "#" & dtmDbEndDate & "#" Else dtmDbStartDate = "'" & dtmDbStartDate & "'" dtmDbEndDate = "'" & dtmDbEndDate & "'" End If
strSQL = "SELECT " & strDbTable & "Forum.Forum_name, " & strDbTable & "Topic.Topic_ID, " & strDbTable & "Topic.Subject, " & strDbTable & "Thread.Thread_ID, " & strDbTable & "Thread.Message_date, " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.Username, " & strDbTable & "Thread.Message, " & strDbTable & "Topic.Event_date, " & strDbTable & "Topic.Event_date_end " & _ "FROM " & strDbTable & "Forum, " & strDbTable & "Topic, " & strDbTable & "Author, " & strDbTable & "Thread " & _ "WHERE " & strDbTable & "Forum.Forum_ID = " & strDbTable & "Topic.Forum_ID " & _ "AND " & strDbTable & "Topic.Start_Thread_ID = " & strDbTable & "Thread.Thread_ID " & _ "AND " & strDbTable & "Author.Author_ID = " & strDbTable & "Thread.Author_ID " & _ "AND " & strDbTable & "Topic.Event_date BETWEEN " & dtmDbStartDate & " AND " & dtmDbEndDate & _ "ORDER BY " & strDbTable & "Topic.Event_date " & "ASC;"
'Query the database rsCommon.Open strSQL, adoCon
'Read in db results If NOT rsCommon.EOF Then 'Place the db results into an array sarryRssTopics = rsCommon.GetRows() End If
'Close and clear rsCommon.Close Call closeDatabase()
'Loop through recordset, read data, and display all events in the next year
Do While intCurrentRecord <= Ubound(sarryRssTopics, 2) lngTopicID = CLng(sarryRssTopics(1, intCurrentRecord)) lngMessageID = CLng(sarryRssTopics(3, intCurrentRecord)) strSubject = sarryRssTopics(2, intCurrentRecord) dtmEventMonth = MonthName(Month((sarryRssTopics(8, intCurrentRecord))),False) dtmEventDay = Day((sarryRssTopics(8, intCurrentRecord))) dtmEventYear = Year((sarryRssTopics(8, intCurrentRecord))) Response.Write("<div class=""calendarlink"">") Response.Write("<a href=""" & strForumPath & "forum_posts.asp?TID=" & lngTopicID & "&PID=" & lngMessageID & """>" & strSubject &"</a>") Response.Write("</div>") Response.Write("<div class=""calendardate"">") Response.Write(dtmEventMonth & " " & dtmEventDay & ", " & dtmEventYear) Response.Write("</div>")
intCurrentRecord = intCurrentRecord + 1 Loop %>
|