Author |
Topic |
ajhvdb
Junior Member
Netherlands
392 Posts |
Posted - 20 November 2004 : 19:07:28
|
Thx, needed something like this but it took me an hour to find out that line 3 needed to be: tblCode = Split(fString, "[table")
|
|
|
ajhvdb
Junior Member
Netherlands
392 Posts |
Posted - 20 November 2004 : 19:25:00
|
For the breaks i also replaced: 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)
With: tblCode(i) = replace(tblCode(i), "]<br />[", "][")
Not tested live
|
|
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
Posted - 21 November 2004 : 01:25:42
|
quote: Thx, needed something like this but it took me an hour to find out that line 3 needed to be: tblCode = Split(fString, "[table")
Thats in the main topic.... Is there a problem with that line?
quote: For the breaks i also replaced: 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)
With: tblCode(i) = replace(tblCode(i), "]<br />[", "][")
That wont do anything... my code didnt even do anything (cant figure that out yet...), but looking for <br /> being right inbetween brackets like that wont happen, unless by chance its like that in the db (rare it might happen) |
-Stim |
|
|
ajhvdb
Junior Member
Netherlands
392 Posts |
Posted - 21 November 2004 : 09:58:55
|
quote: Is there a problem with that line?Thats in the main topic....
Please look at the main topic, in my browser that line is displayed as: tblCode = Split(fString, "")
quote: That wont do anything...
With the suggested code there won't be any empty lines before the table if you enter: [table align=center table] [tr table] [td table]Cell 1 [/td] [/tr] [/table]
|
Edited by - ajhvdb on 21 November 2004 09:59:48 |
|
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
Posted - 21 November 2004 : 15:39:59
|
ah, I apologize, I hadnt realized that, sorry :( Fixed the main topic. |
-Stim |
|
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
Posted - 07 December 2004 : 08:30:53
|
Updated - 12/07/04
Fixed the line breaks issue, it is now safe to put the [tr and [td tags on new lines without affecting the format of the table
(previously it would insert a <br /> between those tags, and anyone who knows html knows how that ends up)
Also fixed multiple tables within one post issue |
-Stim |
Edited by - Da_Stimulator on 07 December 2004 09:20:56 |
|
|
jensen
New Member
United Kingdom
97 Posts |
Posted - 23 December 2004 : 08:32:59
|
I added the code to inc_func_common.asp and also added the countsubs function to inc_func_common.asp
But i dont get tables i get the text...[table align=center table][tr table][td table]Cell 1[/td][/tr][/table] as entered.
This is my moded inc_func_common.asp - what have i done wrong?
'############### table tags ##################
function CountSubs(fString, fSubString)
CountSubs = UBound(split(fString, fSubString))
end function
'############### end table tags ##################
function extratags(fString)
'################# Tables tags #####################
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)
'############### end table tags ##################
fString = doCode(fString, "", "", "<font color=""" & CColor & """>", "</font id=""" & CColor & """>")
extratags = fString
end function
|
Edited by - jensen on 23 December 2004 09:30:05 |
|
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
Posted - 23 December 2004 : 11:56:52
|
You're missing this part:
dim tblCode, ftrLoc, ftdLoc, ftrClo, ftdClo, ftblEn, JoinBack
dim ftblBr, clearBreaksS1, clearBreaksS2
tblCode = Split(fString, "[table")
That should go right before this line:
For i=0 to Ubound(tblCode)
|
-Stim |
|
|
Topic |
|
|
|