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

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Anti-Silly-Post code
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 06 March 2002 :  15:04:43  Show Profile  Visit D3mon's Homepage
I've been alerted to a problem on my forums with posts that have a large number of characters in succession without a space in - like holding down a key for 5 seconds and getting 100 w's.
The browser seems to be unable to wrap them (presumably because theres no space character in it) and it ruins my layout.

I've an idea how to fix it but I'm stuck on the specifics of the code. What I'm looking for is VBscript that will take the message string and create an Array with each array element having the 'next' 30 characters in the string - kind of like Split() but it divides the string up every 30 characters and not buy finding spaces or commas etc.

Each array element is then checked for a 'space' character (by using Instr() I think..). If it couldn't find one, it adds one to the end of that part of the string.
Then it rebuilds the string at the end, and displays it as normal.

D3mon

redbrad0
Advanced Member

USA
3725 Posts

Posted - 07 March 2002 :  02:06:11  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
well if you do that so every line will have 30 characters, then you can loose all kind of formating with posting code, font colors, and everything else. a easy way to do it though would to do something like this when the message is displayed...


strBodyText = "This si the body test so it should wrap after 30 characters even counting the spaces so hopefully this line will come out in a couple different lines."

do until strBodyText=""
strTempBodyText=Left(strBodyText, 30)
strBodyText=Right(strBodyText, (len(strBodyText)-30))
Response.Write strTempBodyText & "<br>"
loop


i never tested this, but i think i have it right, and if i dont, if someone can please help me fix the code.

Brad
Web Hosting with SQL Server @ $24.95 per month
Snitz Mod Archive

Go to Top of Page

kimkr
Starting Member

Denmark
36 Posts

Posted - 07 March 2002 :  03:28:54  Show Profile
In another thread one asked the same, and i made a littel function which can do the job... I don't know where to put it (I havn't got the forum code right here) - so you have to figure that one out yourself - Se the following link http://forum.snitz.com/forum/topic.asp?TOPIC_ID=23424

Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 07 March 2002 :  04:19:58  Show Profile  Visit D3mon's Homepage
Ah splendid, just the job.
I figured the best place to put it is in the FormatStr function which is called just before the string is displayed in topic.asp.
Alternatively it could be done as part of the string processing on the 'new post' messages (that way it gets stored nicely formatted too.)

D3mon
Go to Top of Page
  Previous Topic Topic Next Topic  
 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.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07