Author |
Topic |
|
AceC
New Member
Cyprus
68 Posts |
Posted - 28 June 2002 : 16:27:26
|
I am trying to use a version of the chkString function to strip the forum code out of messages so that I can use the title attribute of the <a> tag to give users a preview of the message.
Forum.asp uses
title="<% =msgprvwString(left(rs("T_MESSAGE"), 150), "message") %>...">
in the topic link where msgprvwString is the customised function.
Basically I copied chkString and replaced all instances of chkString with msgprvwString.
I edited the fstring=docode ... to things like
fString = doCode(fString, "[ quote]", "[ /quote]", "quote:", " :: end of quote.")
so that when you mouseover the link, you don't see any formatting code. In this instance, you should see quote: instead of <BLOCKQUOTE.... in the pop up.
But it doesn't seem to work. I still get <BLOCKQUOTE.... instead of quote:
CAn anyone help?
Test page for this is at http://www.aircadetcentral.com/forum/forum2.asp?FORUM_ID=2
And the hit's just keep on comin'
Edited by - ruirib on 28 June 2002 16:51:26 |
|
Dan Martin
Average Member
USA
528 Posts |
Posted - 05 July 2002 : 05:13:59
|
Did you ever perfect this? That's a MOD I'd like to have.
|
|
|
DoraMoon
Average Member
Taiwan
661 Posts |
Posted - 05 July 2002 : 10:33:19
|
i think the text message already transfer to HTML then save on database when you posted. (seem except [url & [img forum code ?? ) so if we want to see the original forum code, maybe it should be.. msgprvwString(left(CleanCode(rs("T_MESSAGE")), 150), "message") CleanCode() to transfer it back first...
below is how i doing.... i add a "tooltip" option in ChkString function :
if fField_Type = "tooltip" then fString = Replace(fString, """", "") fString = Replace(fString, "'", "") fString = Replace(fString, CHR(13), "") fString = Replace(fString, CHR(10) & CHR(10), ".") fString = Replace(fString, CHR(10), ".") chkString = fString exit function end if
this can get rid of non-necessary break line or commom ...
and then add a new function RemoveForumCode in inc_functions.asp
Function RemoveForumCode( strText ) Dim mPos1 Dim mPos2 mPos1 = InStr(strText, "[") Do While mPos1 > 0 mPos2 = InStr(mPos1 + 1, strText, "]") If mPos2 > 0 Then strText = Left(strText, mPos1 - 1) & Mid(strText, mPos2 + 1) Else Exit Do End If mPos1 = InStr(strText, "[") Loop RemoveForumCode = strText End Function
i think this remove "ALL" thing between [ & ] .... !!??
then just ... title="<% =ChkString(left(RemoveForumCode(CleanCode(rs("T_MESSAGE"))), 150), "tooltip") %>...">
i am not a programmer, above code all read (and learn..) from other's articles on this forum. so i really don't know how to keep the "quote:"... as u want, it just take away all forum codes...
hope this give some help for u ~
~~ ¡¹ ¡¸ ¡¸¡¹ ¡¸ ¡¹ ~~
Edited by - DoraMoon on 05 July 2002 10:45:28 |
|
|
Hamlin
Advanced Member
United Kingdom
2386 Posts |
Posted - 05 July 2002 : 10:52:01
|
if its in the database it still has the < and > round the HTML so this
Function RemoveHTML( strText ) Dim nPos1 Dim nPos2 nPos1 = InStr(strText, "<") Do While nPos1 > 0 nPos2 = InStr(nPos1 + 1, strText, ">") If nPos2 > 0 Then strText = Left(strText, nPos1 - 1) & Mid(strText, nPos2 + 1) Else Exit Do End If nPos1 = InStr(strText, "<") Loop RemoveHTML = strText End Function
Would remove the tags and leave the text "quote :" if there was a quote
I feel sorry for people who don't drink. When they wake up in the morning, that's as good as they're going to feel all day. --Frank Sinatra |
|
|
DoraMoon
Average Member
Taiwan
661 Posts |
Posted - 05 July 2002 : 11:18:01
|
yeh~ Hamlin is right ! in fact, i need both RemoveHTML & RemoveForumCode process on my forum. because i have the HTML Allowed (i really don't want to do this, but i can't.... )
but i think most of people would just ForumCode Allowed only, and the CleanCode function should turn back these < & > to forum code. right ?
so thx Hamlin to remind this... if u have HTML allowed too, maybe.. ChkString(left(RemoveForumCode(RemoveHTML(rs("T_MESSAGE"))), 150), "tooltip") just the right one !
~~ ¡¹ ¡¸ ¡¸¡¹ ¡¸ ¡¹ ~~ |
|
|
|
Topic |
|
|
|