Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Simple Slash Mod
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 5

RebelTech
Average Member

USA
613 Posts

Posted - 28 November 2003 :  04:57:06  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
Simple Slash Mod for Snitz vers 3.4.03

This mod allows you to display content from your forums on any page you choose.
As in the last or most recent topics. I know this has been done to death in some
aspects. But other news or recent posts mods are either for older versions of Snitz,
part of another mod, do not display content from the body of a post or require
database modification.

This mod will allow you to display the author, date and time posted, subject title
of the post, a link to the original post, the number of replies and a portion of
text from the body of the post. The number of topics to be displayed, which forum(s)
are displayed and how much content from the body of the topic is shown are all configurable.

Ease of installation: 1 (1=easy 10=hard)

To install decide if you want to use the mod as a simple, basic stand alone .asp page
or as an include in another page.
No matter which way you choose to use it all you have to do to configure it is edit the
following lines:

Const intTopicCount = 5
This line decides how many topics to display


Const ForumID = "ANY"
This line decides which forum to get the topics from. Either enter the number of a specific forum or "ANY" for all forums.


Const CharsToDisplay = 2000
This line decides how many characters from the topic body
will be displayed.


If you want to use this mod in another page simply place the include statement in the
page in which you want to display the latest topics. Like this:

%>
<!--#include file="inc_simple_slash.asp"-->
<%


A demo of this mod can be seen at www.spinbusters.com
The zip file containing the readme, inc_simple_slash.asp, simple_slash.asp can be
found at ftp://ftp.spinbusters.com/simpleslash.zip -zip file updated 11/29/03
or at www.snitzbitz.com

** Topics aren't checked to see if they're in a private forum or not, so if you set the display = "ALL" it would show recent posts even in private member only or password protected forums.

Original Post
quote:
I know this has been covered a million times. I have done many searches and read many threads on this and I am still fairly lost for a good answer.
I would like to display recent posts on my front page. I really like the way it is done here: www.snowmobilefanatics.com/" target="_blank">http://www.snowmobilefanatics.com/

I was told they use the Slash mod. I have not confirmed that but I did email. The Slash mod I have not been able to find. I have checked the threads here but I did not find a working link for the code. I also read that this mod is outdated for the current version of Snitz.

I looked at Content Display. But I do not want to install the Avatar or Message Icons mods and Content Display seems dependent on these two. Also, in reading the readme file, it appears that you must specify which forums or categories to draw the posts from. That counts out Front Pages News mod also. I was leaning more towards the last 5 topics.

I am using Doramoon's Syndicate.asp . It works great but it will not display content from the body of a post. After using this one and seeing that it uses javascript to query the db and display the info, it seems that what I am wanting should be very simple (just not for me).

So could anybody help this slow Snitzer and show me what and where I can find what I need? Also, with all informative answers to this thread maybe the amount of posts asking about this subject will diminish

Edited by - RebelTech on 29 November 2003 22:36:59

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 28 November 2003 :  07:53:28  Show Profile  Visit Gremlin's Homepage
It's actually quite simple, all the info you need exists in topic.asp already, the query is there to select the topic all you need to do is change it to select the number of topics you want and then put some code in to display it however you want.

A very basic page would go something like this


<!--#include file="config.asp"-->
<!--#include file="inc_func_common.asp" -->
<%
'---------------------------------------------------
' Gremlins Simple Slash MOD
' Simply displays the last intTopicCount topics
' From ForumID (Use ForumID = "ANY" for all Forums)
'---------------------------------------------------

Const intTopicCount = 5
Const ForumID = "ANY"
Const CharsToDisplay = 2000

'------------
' Get Topics
'------------
strSql = "SELECT TOP " & intTopicCount & " "
strSql = strSql & strTablePrefix & "TOPICS.TOPIC_ID, "
strSql = strSql & strTablePrefix & "TOPICS.T_SUBJECT, "
strSql = strSql & strTablePrefix & "TOPICS.T_MESSAGE, "
strSql = strSql & strTablePrefix & "TOPICS.T_DATE, "	
strSql = strSql & strTablePrefix & "TOPICS.T_AUTHOR, "
strSql = strSql & strTablePrefix & "MEMBERS.MEMBER_ID, "
strSql = strSql & strTablePrefix & "MEMBERS.M_NAME "
strSql = strSql & " FROM ((" & strTablePrefix & "FORUM " 
strSql = strSql & "INNER JOIN " & strTablePrefix & "TOPICS ON " 
strSql = strSql & strTablePrefix & "FORUM.FORUM_ID = " 
strSql = strSql & strTablePrefix & "TOPICS.FORUM_ID) " 
strSql = strSql & "INNER JOIN " & strTablePrefix & "MEMBERS ON "
strSql = strSql & strTablePrefix & "TOPICS.T_AUTHOR = " 
strSql = strSql & strTablePrefix & "MEMBERS.MEMBER_ID) "
If ForumID <> "ANY" Then strSql = strSql & " WHERE " & strTablePrefix & "TOPICS.FORUM_ID = " & ForumID
strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_DATE DESC "
  
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnString
Set objRS = objConn.Execute(strSQL)

While Not objRS.EOF
  Response.Write "Posted by: " & objRS("M_NAME") & " on " & strToDate(objRS("T_DATE")) & "<BR>"
  Response.Write ChkString(objRS("T_SUBJECT"),"title") & "<BR>"
  Response.Write Left(RemoveHTML(FormatStr(objRS("T_MESSAGE"))),CharsToDisplay) & "<BR>"
  Response.Write "<a href='topic.asp?TOPIC_ID=" & objRS("TOPIC_ID") & "'>more »</a>"
  Response.Write "<HR SIZE='1' NOSHADE>"
  objRS.MoveNext()
Wend

objRS.Close()
Set objRS = Nothing
objConn.Close()
Set objConn = Nothing

Response.End

Function RemoveHTML( strText )
  Dim TAGLIST
  TAGLIST=";A;B;IMG;CENTER;FONT;PRE;"
    
  Dim nPos1
  Dim nPos2
  Dim nPos3
  Dim strResult
  Dim strTagName
  Dim bRemove
  Dim bSearchForBlock
  
  nPos1 = InStr(strText, "<")
  Do While nPos1 > 0
    nPos2 = InStr(nPos1 + 1, strText, ">")
    If nPos2 > 0 Then
      strTagName = Mid(strText, nPos1 + 1, nPos2 - nPos1 - 1)
      strTagName = Replace(Replace(strTagName, vbCr, " "), vbLf, " ")
      nPos3 = InStr(strTagName, " ")
      If nPos3 > 0 Then
        strTagName = Left(strTagName, nPos3 - 1)
      End If
         
      If Left(strTagName, 1) = "/" Then
        strTagName = Mid(strTagName, 2)
        bSearchForBlock = False
      Else
        bSearchForBlock = True
      End If
           
      If InStr(1, TAGLIST, ";" & strTagName & ";", vbTextCompare) > 0 Then
        bRemove = True
        
        If bSearchForBlock Then
        
          If InStr(1, BLOCKTAGLIST, ";" & strTagName & ";", vbTextCompare) > 0 Then
            nPos2 = Len(strText)
            nPos3 = InStr(nPos1 + 1, strText, "</" & strTagName, vbTextCompare)
        
            If nPos3 > 0 Then
              nPos3 = InStr(nPos3 + 1, strText, ">")
            End If
                      
            If nPos3 > 0 Then
              nPos2 = nPos3
            End If
            
          End If
          
        End If
        
      Else
        bRemove = False
      End If
          
      If bRemove Then
        strResult = strResult & Left(strText, nPos1 - 1)
        strText = Mid(strText, nPos2 + 1)
      Else
        strResult = strResult & Left(strText, nPos1)
        strText = Mid(strText, nPos1 + 1)
      End If
    Else
      strResult = strResult & strText
      strText = ""
    End If
      
    nPos1 = InStr(strText, "<")
  Loop
  strResult = strResult & strText    
  RemoveHTML = strResult
End Function  
%>

I've only barely tested that this works, it doesnt check for private forums or anything of that nature, hopefully it's enough for you to work with though.

Kiwihosting.Net - The Forum Hosting Specialists

Edited by - Gremlin on 28 November 2003 17:34:17
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 28 November 2003 :  08:38:45  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
Thank you Gremlin. I have it working and I am about to address the cosmetics. You have provided just about what I was looking for!. One thing though, can I and if so how do I limit the number of characters displayed from the message body and how would I grab the topic url so I could add a link like "Read More". Thanks again.
Go to Top of Page

Cliff
Average Member

United States
501 Posts

Posted - 28 November 2003 :  08:48:56  Show Profile  Visit Cliff's Homepage
Both Crash and ServerHacker offer this in their packages. You might want to take a look at theirs.
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 28 November 2003 :  09:23:04  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
Would it be something like this for the read more?:

Response.Write "<a href=""" & objRS("TOPIC_ID") & """>Read More</a>"
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 28 November 2003 :  09:29:11  Show Profile  Visit Gremlin's Homepage
To limit the number of characters displayed, just chuck in a left command.

I've updated the code above to show you how, changes in red.

Kiwihosting.Net - The Forum Hosting Specialists

Edited by - Gremlin on 28 November 2003 09:31:14
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 28 November 2003 :  09:33:02  Show Profile  Visit Gremlin's Homepage
quote:
Originally posted by Cliff

Both Crash and ServerHacker offer this in their packages. You might want to take a look at theirs.


No offense to either ServerHacker or Crash, but I think both those portals are a little function heavy now, we've had a few problems with customers running these and resource usage, and they really aren't all that "dial-up" user friendly either.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

Cliff
Average Member

United States
501 Posts

Posted - 28 November 2003 :  09:35:51  Show Profile  Visit Cliff's Homepage
I have the Slash mod, but it is Crash's. I'd feel funny posting it here without his permission. I recommend you download his portal. The slash.asp page isn't all you need. It's controlled inside of the admin pages. It works rather nice.

Either way, this is what I found.

<font color=""#ADADAD"" face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><b>[</b> <a href=""" & strForumURL & "link.asp?TOPIC_ID=" & TOPIC_ID & """><font color=""#ADADAD""><b>read more</b></font></a>
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 28 November 2003 :  09:43:00  Show Profile  Visit Gremlin's Homepage
Made another couple of updates, everything highlighted in RED, this adds the "more" link and the limiting of the number of characters to display. Hope that helps you out some.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 28 November 2003 :  09:54:36  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
I get the following error:
Item cannot be found in the collection corresponding to the requested name or ordinal. 
/forum/gremlinslash.asp, line 43


Line 43 is this:
code] Response.Write "<a href=""topic.asp?TOPIC_ID=" & objRS("TOPIC_ID") & """>more »</a>"
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 28 November 2003 :  09:56:39  Show Profile  Visit Gremlin's Homepage
double check your code vs mine, you might have grabbed it before I finished last updates.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 28 November 2003 :  10:07:57  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
I did! I was slowly typing a reply while you posted the fixes. New problem.

The very first code you posted worked fine. Then asked for the read more and length changes and now it grabbed the first topic and displayed everything fine. The second topic gets the member name, posted time/date, the subject title and about 40 characters from the body and then it starts with about 30 or so characters from the third topic body which are placed inside a forum quote and then the second read more link that leads to the third article... here is the url if that helps http://www.spinbusters.com/forum/mytest.asp
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 28 November 2003 :  10:37:42  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
I have set "Const CharsToDisplay =" to 20 then to 50 and finally to 75 and it works great! Is it possible that if a post is less than the maximum characters that it messes it up?

---
Bumped the shown characters up to 100 and it killed it again.

Edited by - RebelTech on 28 November 2003 10:40:04
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 28 November 2003 :  10:42:22  Show Profile  Visit Gremlin's Homepage
i dont see anything that looks wrong there, the code looked ok when i ran a quick test. however it is 4:30am and im reading/replying to this on a pda so i might have missed something , ill check again in the morning

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 28 November 2003 :  10:46:16  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
I am guessing that when a post has less than the CharsToDisplay it messes up. Gremlin thanks for all the help so far. That is some great coding to be thrown out that quick and on a PDA!
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 28 November 2003 :  13:50:05  Show Profile  Visit Gremlin's Homepage
Odd, I can set my copy to 2000 chars and nothing funny happens, and thats many more characters than some of my posts contain.
I wonder if you didn't strike something where the opening of a forum tag was processed and no closing one which caused it to display funny. You'd have to put it back to what it was for me to look at it.

Kiwihosting.Net - The Forum Hosting Specialists

Edited by - Gremlin on 28 November 2003 13:54:16
Go to Top of Page
Page: of 5 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.29 seconds. Powered By: Snitz Forums 2000 Version 3.4.07