Skip to main content
Inspiring
July 9, 2006
Answered

Dynamic Text in Paragraph Form as in Database

I am building a site for a church and am setting up a page for the pastor to input his on thoughts as he sees fit. In the database (access) it has spaces where spaces need to be and you can see where one paragraph ends and the other starts but when I pull it to a page as dynamic text, it all jumbles together in 1 paragraph. can someone help me.

Thanks
This topic is closed to new replies. Start a new post to keep the conversation going.
strings41Correct answer
Inspiring
July 11, 2006
Is there anywhere specific in the code I showed you that I need to put this

<%=Replace(rs02.Fields.Item("ppage").Value,chr(13),"</p><p>")%>

Never mind.

You guys are geniuses.

It worked. I had no doubt you could help out, just me perceiving everthing.

Thanks a ton.

9 replies

Participating Frequently
July 11, 2006
On displaying the text, you have to replace VbCr (Vb Carriage Returns I think) with <BR> tags. Use the replace function.

<%
DIM varTextToDisplay

varTextToDisplay = Replace(rsRecordSet.Fields.Item("textfield").Value, VbCr, "<BR>")

response.write(varTextToDisplay)
%>

I think I've replace Chr(10) before and it worked.

Replace(rsRecordSet.Fields.Item("textfield").Value, Chr(10), "<BR>")

Let me know if that does it. I've done it before, and I'll dig out the code if needed.
Translate
strings41Author
Inspiring
July 11, 2006
I can tell you guys really want to help, but please consider me a beginner. I don't see "VbCr" or "Chr10" in my code anywhere. or what to actually replace. I appreciate everything that has been posted. Can you be a little more specific for adumb programmer.

Thank you in advance

Here is the code for the ASP page


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
' *** Logout the current user.
MM_Logout = CStr(Request.ServerVariables("URL")) & "?MM_Logoutnow=1"
If (CStr(Request("MM_Logoutnow")) = "1") Then
Session.Contents.Remove("MM_Username")
Session.Contents.Remove("MM_UserAuthorization")
MM_logoutRedirectPage = "/login.asp"
' redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage = "") Then MM_logoutRedirectPage = CStr(Request.ServerVariables("URL"))
If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_newQS = "?"
For Each Item In Request.QueryString
If (Item <> "MM_Logoutnow") Then
If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS & "&"
MM_newQS = MM_newQS & Item & "=" & Server.URLencode(Request.QueryString(Item))
End If
Next
if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage = MM_logoutRedirectPage & MM_newQS
End If
Response.Redirect(MM_logoutRedirectPage)
End If
%>
<!--#include file="Connections/thirtyfirst.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="/login.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<!--#include file="Connections/thirtyfirst.asp" -->
<!--#include file="Connections/thirtyfirst.asp" -->
<%
Dim rs02__MMColParam
rs02__MMColParam = "1"
If (Request.QueryString("text") <> "") Then
rs02__MMColParam = Request.QueryString("text")
End If
%>
<%
Dim rs02
Dim rs02_numRows

Set rs02 = Server.CreateObject("ADODB.Recordset")
rs02.ActiveConnection = MM_thirtyfirst_STRING
rs02.Source = "SELECT * FROM texts WHERE ID = " + Replace(rs02__MMColParam, "'", "''") + ""
rs02.CursorType = 0
rs02.CursorLocation = 2
rs02.LockType = 1
rs02.Open()

rs02_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 10
Repeat1__index = 0
rs02_numRows = rs02_numRows + Repeat1__numRows
%>
<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "") Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Admin - Results</title>
<style type="text/css">
<!--
.style1 { font-size: 24px;
font-weight: bold;
color: #990099;
}
-->
</style>
</head>

<body>
<p align="center" class="style1">31st Avenue Missionary Baptist Church<br />
Administration Page </p>
<p align="center">_________________________________________________________</p>
<p align="right"> <a href="<%= MM_Logout %>">Log out</a></p>


<div align="center">
<table width="442" border="0">
<tr>
<td width="442"><div align="left"></div></td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT rs02.EOF)) %>
<tr>
<td width="442"><div align="center">
<p align="left">Message: - <A HREF="/detail.asp?<%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "ID=" & rs02.Fields.Item("ID").Value %>">Edit</A></p>
<div align="left">
<p><%=(rs02.Fields.Item("ppage").Value)%></p>
</div>
</div></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rs02.MoveNext()
Wend
%>
</table>
</div>
<div align="center"></div></body>
</html>
<%
rs02.Close()
Set rs02 = Nothing
%>
I can tell you guys really want to help, but please consider me a beginner. I don't see "VbCr" or "Chr10" in my code anywhere. or what to actually replace. I appreciate everything that has been posted. Can you be a little more specific for adumb programmer.
Translate
Participating Frequently
July 11, 2006
quote:

Originally posted by: strings41
I can tell you guys really want to help, but please consider me a beginner. I don't see "VbCr" or "Chr10" in my code anywhere. or what to actually replace. I appreciate everything that has been posted. Can you be a little more specific for adumb programmer.

===
You can't see teh VBCr or Chr(10) (special character 10). These are the line feeds/carriage returns inserted when somebody presses enter in a multi-line text entry field. They are in the text even if you can't see them.
Translate
July 10, 2006
If you're using an Insert Record behaviour, you need a WYSIWYG editor such as KTML - http://www.interaktonline.com/Products/Online-HTML-Editor/KTML-for-Dreamweaver/Overview/
Translate
Inspiring
July 10, 2006
or this one is really easy to implement and is FREE:

http://www.webwizguide.com/asp/sample_scripts/RTE_application.asp
Translate
strings41Author
Inspiring
July 10, 2006
right now i am using dramweaver's Insert ASP Applications (insert, update, and search record). Can I incorporate the KTML with that? Where do I put it (Results page or update page)?
Translate