Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Strip Post
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Strip Post

 Post Reply Post Reply
Author
Rebel Gaa View Drop Down
Groupie
Groupie


Joined: 04 September 2003
Location: Ireland
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rebel Gaa Quote  Post ReplyReply Direct Link To This Post Topic: Strip Post
    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

Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Rebel Gaa View Drop Down
Groupie
Groupie


Joined: 04 September 2003
Location: Ireland
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rebel Gaa Quote  Post ReplyReply Direct Link To This Post Posted: 05 May 2004 at 5:59am
Cheers boRg, much appreciated.
Back to Top
Rebel Gaa View Drop Down
Groupie
Groupie


Joined: 04 September 2003
Location: Ireland
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rebel Gaa Quote  Post ReplyReply Direct Link To This Post 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

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

Back to Top
Rebel Gaa View Drop Down
Groupie
Groupie


Joined: 04 September 2003
Location: Ireland
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rebel Gaa Quote  Post ReplyReply Direct Link To This Post Posted: 21 May 2004 at 11:06am
Any idea's or hints?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.