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)
 Table Mod need help coding
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

phy1729
Average Member

USA
589 Posts

Posted - 18 January 2008 :  23:56:51  Show Profile  Reply with Quote
Started coding a table mod but don't know how to code some things any help would be appreciated. Places I need help are commented in red. Any improvements are also welcome.

function ChkTable(ByVal fString)

	Dim Counter
	Dim tblopen
	Dim tropen
	Dim tdopen
	Dim go
	tblopen=0
	tropen=0
	tdopen=0
	go=1

	ChkTable = fString

	for Counter = 1 To UBound(fString)
		if tblopen > 0 then
			if tblopen=tropen then
				if tropen=tdopen then
					if UCase(Right(strArray(Counter-1), 7)) = "[TABLE]" then
						'replace [TABLE] with <table>
						tdopen--
					end if
					if UCase(Right(strArray(Counter-1), 5)) = "[/TD]" then
						'replace [/TD] with </td>
						tdopen--
					end if
				else
					if UCase(Right(strArray(Counter-1), 4)) = "[TD]" then
						'replace [TD] with <td>
						tdopen++
					end if
					if UCase(Right(strArray(Counter-1), 5)) = "[/TR]" then
						'replace [/TR] with </tr>
						tropen--
					end if
				end if
				'code something that will delete anything else (not necessary)
			else
				if UCase(Right(strArray(Counter-1), 4)) = "[TR]" then
					'replace [TR] with <tr>
					tropen++
				end if
				if UCase(Right(strArray(Counter-1), 8)) = "[/TABLE]" then
					'replace [/TABLE] with </table>
					tblopen--
				end if
				'code something that will delete anything else (not necessary)
			end if
		else
			if UCase(Right(strArray(Counter-1), 7)) = "[TABLE]" then
				'replace [TABLE] with <table>
				tblopen++
			end if
		end if

	next
	'Close all open tags
	Do While go=1
		if tblopen>0 then
			if tropen>tblopen then
				if tdopen>tropen then
					'add </td> to end of string
				else
					'add </tr> to end of string
				end if
			else
				'add </table> to end of string
			end if
		else
			go=0
		end if
	Loop

end function

Edit #1: Fixed mistake #1<

Edited by - phy1729 on 19 January 2008 00:42:45

muzishun
Senior Member

United States
1079 Posts

Posted - 19 January 2008 :  02:31:05  Show Profile  Visit muzishun's Homepage  Reply with Quote
I seem to remember some code a few years ago that someone had made a table mod already. I think (but don't quote me) that it was HuwR's code originally.

I'll see if I can find the original post(s).

Edit: Found it. Here's the original post. It wasn't HuwR... it was Da_Stimulator.

I would imagine that mod should still work with the current version of the forum, but make sure to backup your files to be on the safe side (as always).<

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)

Edited by - muzishun on 19 January 2008 02:35:44
Go to Top of Page

phy1729
Average Member

USA
589 Posts

Posted - 19 January 2008 :  12:33:02  Show Profile  Reply with Quote
I've heard (may be wrong) that it's easy to hijack the layout with that mod so I'm trying to make a new mod that force everything to be closed. But I could be wrong about the easy to leave tags unclosed.<
Go to Top of Page

muzishun
Senior Member

United States
1079 Posts

Posted - 20 January 2008 :  02:22:55  Show Profile  Visit muzishun's Homepage  Reply with Quote
The first draft of that MOD didn't have any error checking, but according to the thread, da_stim added that feature in (as well as allowing line breaks between the tags so you didn't have to put everything on one row). I certainly don't want to tell you not to recode it if you have your mind set, but it at least could give you a starting point so you don't have to redo the *entire* thing. <

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Go to Top of Page

phy1729
Average Member

USA
589 Posts

Posted - 20 January 2008 :  11:47:43  Show Profile  Reply with Quote
Well if it works and is secure then I don't want to code something already there. Thanks muzishun.<
Go to Top of Page

muzishun
Senior Member

United States
1079 Posts

Posted - 20 January 2008 :  12:03:05  Show Profile  Visit muzishun's Homepage  Reply with Quote
You're welcome. If you try it out and it does what you want, post back and let me know. I've been wanting table tags myself, so I'll use yours or stimmy's, depending on which one works better .<

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000 Version 3.4.07