Print Page | Close Window

Strip Post

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=10296
Printed Date: 08 April 2026 at 10:28am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Strip Post
Posted By: Rebel Gaa
Subject: Strip Post
Date Posted: 05 May 2004 at 5:43am

Apologies if this sounds a stupid question.

What i want to do is display the last post on my site outside the forum. (the actual message part) At the moment i have it set up to do so and its displaying the last post, no problem. My problem with it is, it also displays the avatars, quotes etc. I want to strip all this off and display just the core text. Is their anyway of doing this?

Thanks




Replies:
Posted By: WebWiz-Bruce
Date Posted: 05 May 2004 at 5:54am
In the include file 'functions_filters.asp' there is a function called removeHTML that is used to display the contents of a topic if you hover the mouse over the link to the topic on the page displaying all the topics.

This function could be used to do what you require.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: Rebel Gaa
Date Posted: 05 May 2004 at 5:59am
Cheers boRg, much appreciated.


Posted By: Rebel Gaa
Date Posted: 20 May 2004 at 10:06am

The following code strips html from text. Any ideas how i could change the code so it will strip some html and not others eg remove <font> tag but leave <br> tags.

------------------------------------------------------------ -------

Private Function removeHTML(ByVal strMessageInput)

 Dim lngMessagePosition  
 Dim intHTMLTagLength  
 Dim strHTMLMessage  
 Dim strTempMessageInput  

 
 strTempMessageInput = strMessageInput

For lngMessagePosition = 1 to CLng(Len(strMessageInput))

 If Mid(strMessageInput, lngMessagePosition, 1) = "" Then Exit For
  
    If Mid(strMessageInput, lngMessagePosition, 1) = "<" Then

   
   intHTMLTagLength = (InStr(lngMessagePosition, strMessageInput, ">", 1) - lngMessagePosition)
   
      If intHTMLTagLength < 0 Then intHTMLTagLength = CLng(Len(strTempMessageInput))

      strHTMLMessage = Mid(strMessageInput, lngMessagePosition, intHTMLTagLength + 1)


   
   strTempMessageInput = Replace(strTempMessageInput, strHTMLMessage, "", 1, -1, 0)
   
  End If
 Next
 
 'Replace a few characters in the remaining text
 strTempMessageInput = Replace(strTempMessageInput, "<", "&lt;", 1, -1, 1)
 strTempMessageInput = Replace(strTempMessageInput, ">", "&gt;", 1, -1, 1)
 strTempMessageInput = Replace(strTempMessageInput, "'", "", 1, -1, 1)
 strTempMessageInput = Replace(strTempMessageInput, """", "&#034;", 1, -1, 1)
 strTempMessageInput = Replace(strTempMessageInput, "&nbsp;", " ", 1, -1, 1)
         strTempMessageInput = Replace(strTempMessageInput, "’", "", 1, -1, 1)
         strTempMessageInput = Replace(strTempMessageInput, "^", "", 1, -1, 1)
         strTempMessageInput = Replace(strTempMessageInput, "~", "", 1, -1, 1)
 strTempMessageInput = Replace(strTempMessageInput, "€", "", 1, -1, 1)
 
 'Return the function
 removeHTML = strTempMessageInput
End Function

------------------------------------------------------------ -------



Posted By: Rebel Gaa
Date Posted: 21 May 2004 at 11:06am
Any idea's or hints?



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net