Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

response writing asp script

Status
Not open for further replies.

tyutghf

Technical User
Apr 12, 2008
258
GB
I have a cms that outputs the contents of a particular row of the database to the page

<%=rs("content")%>

This works fine when the content is html, I would like to add asp to the row within the database, however the raw code is being printed to the page instead of the asp. Here's an example as my explanation is rubbish

if DB row contains plain html text such as <b>hello</b> the output will be

hello

if I put asp into the field such as <%=now()%> I want the output to be 12:20pm 17/07/2008 but the output is the raw asp code

<%=now()%>

Are there any ways to get around this?

Thanks
 
My guess would be that once ASP has outputted the contents of a database row to the browser for display the time for server side processing has passed. That and the fact that I think "now" is VB script anyway.

Dim d_today
d_today=Now
Response.Write d_today

would output the time in the browser I think.

Others will know better, but perhaps one could load the database with some Javascript that would do the time magic and which then might be rendered in the browser.

 
thanks for the response, I am also writing much more than just the date as I used that as an xample, I am also grabbing data from a database.

Does anyone else know how to ensure the text is parsed as html and not just plain text?
 
Well, maybe you could use a "middle processing page". Made that up.

Say, for example, you had the text of an SQL query stored in a field in a record in a database. Someone trickier than me might be able to figure out how to do an intial query that would return the contents of the field to a processing page which would set a variable(s) equal to the query(info) stored in the database and then resolve to a final page processing that variable information into something the user sees.

That seems overcomplicated and a little much. I guess I would ask why are you storing code in a database and is there a way to get where you want to go differently? I realize you are doing more than dates, but to continue the data example, I would store it as data, not code. If I needed it as code, I would save it as a procedure or subroutine or soomething that was code.

What are you trying to do? (Also, if you provide more information than those people who are trickier than me that I was talking about will be more likely to show us their trickiness and respond to your question).



 
Basically I have built a basic cms to allow departments to update their section of the website, it was meant for just html but on a few pages they now want to display a list with data generated from anotehr table in the database. So, instead of creating a new cms page just for these pages I had hoped to just type asp into the textarea.

Does that make sense?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top