Click to See Complete Forum and Search --> : Add Paragraph


ldoodle
04-18-2006, 05:28 AM
Hi there,

I have a script that displays the entries from the Notes field from a user account within AD, but even though I paragraph the actual entries I make, it doesn't refelct this on the page.

Is it possible to use ASP to place a paragraph after every full stop, as the entries are only on sinlge lines, with one full stop?

Thanks very much/...


<%@ Language=VBScript %>
<%
Dim rs, Com, objCon, objADsPath, objDomain, strUsername, strNotes, intIP

strUsername = Request.ServerVariables("LOGON_USER")
strUsername = Right(strUsername, Len(strUsername) - InStrRev(strUsername, "\"))

intIP = Request.ServerVariables("REMOTE_HOST")

Set objDomain = GetObject ("GC://rootDSE")
objADsPath = objDomain.Get("defaultNamingContext")
Set objDomain = Nothing

Set objCon = Server.CreateObject("ADODB.Connection")
objCon.provider ="ADsDSOObject"
objCon.open "Active Directory Provider"

Set Com = CreateObject("ADODB.Command")
Set Com.ActiveConnection = objCon

Com.CommandText ="select info FROM 'GC://"+objADsPath+"' where sAMAccountName='"+strUsername+"'"

Set rs = Com.Execute

If intIP = "10.86.76.26" Then
strNotes = "Your teacher has disabled Internet / E-mail access for every computer in this room."
Else
strNotes=rs("info")
End If

rs.Close
objCon.Close

Set rs = Nothing
Set objCon = Nothing
%>

<Eddie>
04-18-2006, 09:14 AM
The way to do it is to add the HTML markup to the output.


sMyString = Replace(sMyString, ".", ".<br><br>")

Although that will produce the effect, markup should be semantic so you should be <p></p> into the string.

ldoodle
04-18-2006, 10:55 AM
Thanks for that... Got round the <p> </p> by doing this;

strNotes = rs("info")
strNotes = "<p>" & strNotes
strNotes = Replace(strNotes, ".", ".</p>")