Link to home
Start Free TrialLog in
Avatar of Wayne Barron
Wayne BarronFlag for United States of America

asked on

ASP Classic - Insert text, Line breaks and Code

Hello All;

How we supply code here on EE and other sites around the web.
We are able to place code between the code tags.
As well as having our text create line breaks, and then display here to the page,
on the lines
that we originally wrote them on.

My question is this.

I can do a replace during processing, to replace all with something like this.

SQLRemoveString = Replace(SQLRemoveString,vblf,"<br />")
' code information
' about the code goes here.

Open in new window


However, that will replace all the text that is written inside of the CODE tags as well.

How would you write it so that the text is sent to the database with the same carriage returns as I wrote it here?
And the text within the CODE tags, stays the same as it is written, without replacing are carriage returns, with <br />'s during the output back to the page?

(The code tags is something that I have struggled with for years, and asked about several years ago as well. So hopefully, someone will some better incite can shed some like on this issue.)

Wayne
Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

ASKER

I just checked the code here, and every line is wrapped with a <span> tag.

How would you do something like this?

Say you have this.

This is information about
what I want to do.
'the code
'will go here

Open in new window

And then more information goes here.
OK, I can do something like this, which works.

testText = replace(request.Form("Thetext"),vblf,"</span>"&vblf&"<span>")

Open in new window

OR (If I do not want the <span> tags, I can do it this way)
testText = replace(request.Form("Thetext"),vblf,vblf)

Open in new window



How would this be used so that it only does the <span> or vblf within the code tags, and the <br /> throughout the rest of the text submitted?
you can't do the entire form at once. i.e. for EE you would process word by word or character by character and if you hit a {code} then skip until the {/code}
I have thought about that as well, but how would you skip that tag, is the question?
OK, after looking at some Forum ASP scripts (Poorly written crap, to be honest with you)
I found out that.
#1:
The text is sent to the Database with all carriage returns.
#2:
When it is processed back to the page, is when it is coded to add <br /> where needed, and NOT in between the code tags.

The script that I looked at, is so poorly written, that it is hard to find out how anything works.
I got so disgusted while looking through it, that I about lost my mind.
I had to delete it.
I might take a breather and download it again, and take a look and see IF I can find where it does the processing at.
If I can get past the entire page written in .write.....
ASKER CERTIFIED SOLUTION
Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Provided the code I found to do what I needed it to do.
Very happy right now, very happy.

Wayne