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/Code)
 MOD: Forum Code - Table tags
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 14 November 2004 :  01:47:52  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
Description
This mod will allow users to put HTML tables in posts, it also checks to make sure the tables are written using correct syntax, and that all closing tags are present. The code also allows for attributes of align=center, align=left, align=right, valign=top, valign=bottom, border attributes in the [td] and [table] tag; border, cellspacing, cellpadding in [table] tag

I got the idea while sifting through stuff I missed while I was gone... came across This post

Updated 12/07/04 - Fixed line breaks within <table> tags issue, and now multiple tables within a single post works (before it didnt)

Demo 1 - Demo 2 (Test account: test/test)

Syntax:

[table table] = <table>
[table align=center valign=top table] = <table align="center" valign="top">
[table border=1 cellspacing=1 table] = <table border=1 cellspacing=1>

Get the idea? you have to add table] to the end of every tag, except the closing tags

so [table align=center table][tr table][td table]Cell 1[/td][/tr][/table] is correct syntax.

You do NOT want to use linebreaks while making a table, unless you are within table cells. Some reason it wont filter out the breaks like I'd planned....

CODE Instructions:
Put the following code in your inc_func_common.asp file right after you find "function extratags(fString)"


dim tblCode, ftrLoc, ftdLoc, ftrClo, ftdClo, ftblEn, JoinBack
dim ftblBr, clearBreaksS1, clearBreaksS2
tblCode = Split(fString, "[table")
For i=0 to Ubound(tblCode)
  ftblBr = InStr(tblCode(i), " table]")
  ftrLoc = InStr(tblCode(i), "[tr")
  ftdLoc = InStr(tblCode(i), "[td")
  ftrClo = InStr(tblCode(i), "[/tr]")
  ftdClo = InStr(tblCode(i), "[/td]")
  ftblEn = InStr(tblCode(i), "[/table]")
  ClearBreaksS1 = Left(tblCode(i), ftblEn)
  ClearBreaksS2 = Replace(ClearBreaksS1, "<br>", " ")
  ClearBreaksS2 = Replace(ClearBreaksS2, "<br />", " ")
  ClearBreaksS2 = Replace(ClearBreaksS2, Chr(10), " ")
  tblCode(i) = replace(tblCode(i), ClearBreaks1, ClearBreaks2)
  if ftdLoc > ftrLoc and _
  (ftdClo > ftdLoc and ftdClo < ftrClo) and _
  (ftrClo < ftblEn and ftrClo > ftdClo) and _
  ftblEn > ftrClo and _
  CountSubs(tblCode(i), "[tr")=CountSubs(tblCode(i), "[/tr]") and _
  CountSubs(tblCode(i), "[td")=CountSubs(tblCode(i), "[/td]") and _
  CountSubs(fString, "[/table]")=Ubound(tblCode) then
    tblCode(i) = replace(tblCode(i), " align=center", " align=""center""")
	tblCode(i) = replace(tblCode(i), " align=left", " align=""left""")
	tblCode(i) = replace(tblCode(i), " align=right", " align=""right""")
	tblCode(i) = replace(tblCode(i), " valign=top", " valign=""top""")
	tblCode(i) = replace(tblCode(i), " valign=bottom", " valign=""bottom""")
    tblCode(i) = replace(tblCode(i), "[tr", "<tr")
	tblCode(i) = replace(tblCode(i), "[td", "<td")
	tblCode(i) = replace(tblCode(i), "[/td]", "</td>")
	tblCode(i) = replace(tblCode(i), "[/tr]", "</tr>")
	tblCode(i) = replace(tblCode(i), "[/table]", "</table>")
	tblCode(i) = replace(tblCode(i), " table]", ">")
	JoinBack = "<table"
   else
        JoinBack = "[table"
   end if
Next
fString = Join(tblCode, JoinBack)


also...
You must add the following function to inc_func_common.asp


function CountSubs(fString, fSubString)
	 CountSubs = UBound(split(fString, fSubString))
end function

-Stim

Edited by - Da_Stimulator on 07 December 2004 09:18:01

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 14 November 2004 :  01:53:23  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
quote:
Put the following code in your inc_functions.asp ...

I guess you mean inc_func_common.asp...

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 14 November 2004 :  01:54:46  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
ugh.... old habits die hard

-Stim
Go to Top of Page

homeacademy
Junior Member

USA
163 Posts

Posted - 14 November 2004 :  08:15:26  Show Profile
Thanks for doing this, stimmy. I went to http://stimmy.a1.no-ip.org/topic.asp?TOPIC_ID=20, logged in and tried to test. I did something along the lines of

[table align=center table][tr table][td align=center table]Testing...[/td][td align=right table]Still testin'[/td][/tr][/table]

I may have typed something wrong when I posted, I'm really not sure, but now it gives a VBScript error when it tries to display my reply. See http://stimmy.a1.no-ip.org/topic.asp?TOPIC_ID=20. I can't click edit to get back to what I actually typed. I could look up my reply ID in the source and enter the edit URL manually, but I'm too lazy... Do you know what is causing the problem?
Go to Top of Page

PeeWee.Inc
Senior Member

United Kingdom
1893 Posts

Posted - 14 November 2004 :  09:13:57  Show Profile  Visit PeeWee.Inc's Homepage
Microsoft VBScript runtime error '800a000d'

Type mismatch: 'cLng'

/inc_func_common.asp, line 695


You get that on a replie after useing this mod, or so it seems on your site Stimmy

Keep up the good work and i hope it gets sorted

De Priofundus Calmo Ad Te Damine
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 14 November 2004 :  11:54:44  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
has nothing to do with this.... wtf thats the chkTime function

-Stim
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 14 November 2004 :  12:03:11  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
Fixed.... was something with the PM mod

-Stim
Go to Top of Page

serritzlev
Junior Member

Denmark
291 Posts

Posted - 14 November 2004 :  12:39:48  Show Profile  Visit serritzlev's Homepage
Now is back to do a tool bare there do the insert table align < else >, i dont think many can codes the html whay write this here [table align=center table][tr table][td align=center table]if that can ben done in a toolbar or again after the text (Testing...)[/td][td align=right table]Still testin'[/td][/tr][/table].

That is therfore many want the htmlarea mybi combine this white the insert code or a must is born.

BUT KIB THE GOOD WORKS ALIVE: the ide is greath.


Edited by - serritzlev on 14 November 2004 12:40:45
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 14 November 2004 :  12:40:12  Show Profile  Visit dayve's Homepage
I did this a long time ago and ended up with disastrous results because members would forget a tag or misuse it and it destroys the entire structure of the forum at times. I would be very careful allowing members to use this. poorly constructed tables can wreak havoc.

Update: Just tried it on your forum and I see if the table sequence is not correct, it will not try to build the table so you shouldn't end up with the problems I had mentioned.


Edited by - dayve on 14 November 2004 12:45:46
Go to Top of Page

PeeWee.Inc
Senior Member

United Kingdom
1893 Posts

Posted - 14 November 2004 :  12:47:01  Show Profile  Visit PeeWee.Inc's Homepage
whats the line on 695?

[edit]
Never mind then

De Priofundus Calmo Ad Te Damine

Edited by - PeeWee.Inc on 14 November 2004 12:53:50
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 14 November 2004 :  13:20:34  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
quote:
Originally posted by dayve

I did this a long time ago and ended up with disastrous results because members would forget a tag or misuse it and it destroys the entire structure of the forum at times. I would be very careful allowing members to use this. poorly constructed tables can wreak havoc.

Update: Just tried it on your forum and I see if the table sequence is not correct, it will not try to build the table so you shouldn't end up with the problems I had mentioned.



Yeah I made it check for correct syntax that was my main concern when writing this

-Stim
Go to Top of Page

homeacademy
Junior Member

USA
163 Posts

Posted - 18 November 2004 :  08:21:12  Show Profile
Nice mod, works well... However, why do we have to use [table table] for the insertation instead of just [table]. For people (like me) who are used to HTML coding, having to put 'table' twice is annoying and against what I'm used to. Why'd you do it that way?
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 18 November 2004 :  12:59:04  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
I tried it just like HTML, but when replacing the ] it messed up any other forum code.... so it was either a choice of [table] without being able to set attributes (boring table), or add something to identify the closing tag....

-Stim
Go to Top of Page

homeacademy
Junior Member

USA
163 Posts

Posted - 18 November 2004 :  16:41:51  Show Profile
Okay, I see. Definatly choose attributes over the ommision of a closing tag. BUT, tho I haven't looked at the code, why does it mess up other forum code? For example, if I want to change font, I do [font face=whatever] not [font face=whatever font]. What's different about your situation? I'll look at the code later and see if it is obvious to me, but just curious...
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 18 November 2004 :  16:44:36  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
because the code function specifically looks for each individual font in that situation. In the table tags situation, if I were to do that, I'd have to specify every possible attribute, or make some unavailable. I suppose I could do that, but I like it being flexible.

-Stim
Go to Top of Page

homeacademy
Junior Member

USA
163 Posts

Posted - 18 November 2004 :  22:16:50  Show Profile
Okay, got it - thanks.
Go to Top of Page
Page: of 2 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.18 seconds. Powered By: Snitz Forums 2000 Version 3.4.07