Table Mod need help coding - Posted (1167 Views)
Average Member
phy1729
Posts: 589
589
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.
Code:

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<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Senior Member
muzishun
Posts: 1079
1079
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)
Posted
Average Member
phy1729
Posts: 589
589
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.<
Posted
Senior Member
muzishun
Posts: 1079
1079
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. smile<
Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Posted
Average Member
phy1729
Posts: 589
589
Well if it works and is secure then I don't want to code something already there. Thanks muzishun.<
Posted
Senior Member
muzishun
Posts: 1079
1079
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 smile.<
Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
 
You Must enter a message