R
Rob Meade
Hi all,
Been a long time since I've been here...
/me waves to all..
Ok - my conundrum..
I have a form where a user can enter text and BB codes...for example:
bold text
I then parse the form when submitted with something like this:
strContent = Replace(strContent, "", "<b>")
strContent = Replace(strContent, "", "</b>")
Content is then written to the database, when displayed out comes the html.
If they want to edit the content again it goes through the parser again but
in reverse affectively and puts all the square brackets back in...
My problem is around the carriage returns...
At the moment I am replacing a vbCRLF with <br> - the problem is when they
have something like this:
I get a load of <br>'s that I don't really want, and of course because the
table stuff in this case is replaced with the html for the table the <br>'s
appear above it pushing it down the page - nightmare...
What I am after I suppose is a way of being able to say - change a vbCRLF
for a <br> but only if it's not proceeding any of the following....
My initial thoughts were parse again - and remove and <br>'s if they are
joined to say any of the above tags...
strContent = Replace(strContent, "</tr><br>", "</tr>")
for example...but it's not pretty, it doesn't feel "clever" and would
require a load of additional parsing where mistakes could easily be made...
The square bracketting tags etc will remain regardless of how this is
resolved, so please no suggestions for css etc, but if anyone has any
'compatible' ideas please let me know.
Regards
Rob
Been a long time since I've been here...
/me waves to all..
Ok - my conundrum..
I have a form where a user can enter text and BB codes...for example:
bold text
I then parse the form when submitted with something like this:
strContent = Replace(strContent, "", "<b>")
strContent = Replace(strContent, "", "</b>")
Content is then written to the database, when displayed out comes the html.
If they want to edit the content again it goes through the parser again but
in reverse affectively and puts all the square brackets back in...
My problem is around the carriage returns...
At the moment I am replacing a vbCRLF with <br> - the problem is when they
have something like this:
my cell | my second cell |
I get a load of <br>'s that I don't really want, and of course because the
table stuff in this case is replaced with the html for the table the <br>'s
appear above it pushing it down the page - nightmare...
What I am after I suppose is a way of being able to say - change a vbCRLF
for a <br> but only if it's not proceeding any of the following....
My initial thoughts were parse again - and remove and <br>'s if they are
joined to say any of the above tags...
strContent = Replace(strContent, "</tr><br>", "</tr>")
for example...but it's not pretty, it doesn't feel "clever" and would
require a load of additional parsing where mistakes could easily be made...
The square bracketting tags etc will remain regardless of how this is
resolved, so please no suggestions for css etc, but if anyone has any
'compatible' ideas please let me know.
Regards
Rob