Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Table Mod need help coding

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
phy1729 Posted - 18 January 2008 : 23:56:51
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<
5   L A T E S T    R E P L I E S    (Newest First)
muzishun Posted - 20 January 2008 : 12:03:05
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 .<
phy1729 Posted - 20 January 2008 : 11:47:43
Well if it works and is secure then I don't want to code something already there. Thanks muzishun.<
muzishun Posted - 20 January 2008 : 02:22:55
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. <
phy1729 Posted - 19 January 2008 : 12:33:02
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.<
muzishun Posted - 19 January 2008 : 02:31:05
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).<

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.1 seconds. Powered By: Snitz Forums 2000 Version 3.4.07