Jump to content
Fórum Script Brasil
  • 0

Quebrando Linhas


Question

para quebrar linhas você tem q fazer o seguinte:

variavel = Replace(rs("campo"),VbCrLf,"<br>")

quando puxa do BD o script substitui Enter por BR e se eu quiser substituir + uma coisa por exemplo:

Alem de Substituir Enter por BR também subtituir [[ por abc!

Como eu faria?

Um Abraço!!!

biggrin.gif

Link to post
Share on other sites

11 answers to this question

Recommended Posts

  • 0

COLOR=red]Também não funfo :S

Olha o código como está e funcionando!

<%@LANGUAGE="VBSCRIPT"%>
<%
' *** 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 = "../index.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/conectaSite.asp" -->
<%

if(Request.QueryString("a") <> "") then spRedirect__varID = Request.QueryString("a")

%>

<%

set spRedirect = Server.CreateObject("ADODB.Command")
spRedirect.ActiveConnection = MM_conectaSite_STRING
spRedirect.CommandText = "UPDATE conteudo SET views = views + 1  WHERE idDown = " + Replace(spRedirect__varID, "'", "''") + " "
spRedirect.CommandType = 1
spRedirect.CommandTimeout = 0
spRedirect.Prepared = true
spRedirect.Execute()
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="../users/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
%>
<%
Dim rsUser__MMColParam
rsUser__MMColParam = "1"
If (Session("MM_Username") <> "") Then 
  rsUser__MMColParam = Session("MM_Username")
End If
%>
<%
Dim rsUser
Dim rsUser_numRows

Set rsUser = Server.CreateObject("ADODB.Recordset")
rsUser.ActiveConnection = MM_conectaSite_STRING
rsUser.Source = "SELECT * FROM users WHERE login = '" + Replace(rsUser__MMColParam, "'", "''") + "'"
rsUser.CursorType = 0
rsUser.CursorLocation = 2
rsUser.LockType = 1
rsUser.Open()

rsUser_numRows = 0
%>
<%
Dim rsMostra__MMColParam
rsMostra__MMColParam = "1"
If (Request.QueryString("a") <> "") Then 
  rsMostra__MMColParam = Request.QueryString("a")
End If
%>
<%
Dim rsMostra
Dim rsMostra_numRows

Set rsMostra = Server.CreateObject("ADODB.Recordset")
rsMostra.ActiveConnection = MM_conectaSite_STRING
rsMostra.Source = "SELECT * FROM conteudo WHERE idDown = " + Replace(rsMostra__MMColParam, "'", "''") + ""
rsMostra.CursorType = 0
rsMostra.CursorLocation = 2
rsMostra.LockType = 1
rsMostra.Open()

rsMostra_numRows = 0
%>
<%
Dim rsPost__MMColParam
rsPost__MMColParam = "1"
If (Request.QueryString("u") <> "") Then 
  rsPost__MMColParam = Request.QueryString("u")
End If
%>
<%
Dim rsPost
Dim rsPost_numRows

Set rsPost = Server.CreateObject("ADODB.Recordset")
rsPost.ActiveConnection = MM_conectaSite_STRING
rsPost.Source = "SELECT * FROM users WHERE id = " + Replace(rsPost__MMColParam, "'", "''") + ""
rsPost.CursorType = 0
rsPost.CursorLocation = 2
rsPost.LockType = 1
rsPost.Open()

rsPost_numRows = 0
%>
<%
Dim rsComents__MMColParam
rsComents__MMColParam = "1"
If (Request.QueryString("a") <> "") Then 
  rsComents__MMColParam = Request.QueryString("a")
End If
%>
<%
Dim rsComents
Dim rsComents_numRows

Set rsComents = Server.CreateObject("ADODB.Recordset")
rsComents.ActiveConnection = MM_conectaSite_STRING
rsComents.Source = "SELECT * FROM coments WHERE idDown = " + Replace(rsComents__MMColParam, "'", "''") + ""
rsComents.CursorType = 0
rsComents.CursorLocation = 2
rsComents.LockType = 1
rsComents.Open()

rsComents_numRows = 0
%>
<%
Dim rsTotalPost__MMColParam
rsTotalPost__MMColParam = "1"
If (Request.QueryString("u") <> "") Then 
  rsTotalPost__MMColParam = Request.QueryString("u")
End If
%>
<%
Dim rsTotalPost
Dim rsTotalPost_numRows

Set rsTotalPost = Server.CreateObject("ADODB.Recordset")
rsTotalPost.ActiveConnection = MM_conectaSite_STRING
rsTotalPost.Source = "SELECT * FROM conteudo WHERE idUser = " + Replace(rsTotalPost__MMColParam, "'", "''") + ""
rsTotalPost.CursorType = 0
rsTotalPost.CursorLocation = 2
rsTotalPost.LockType = 1
rsTotalPost.Open()

rsTotalPost_numRows = 0
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim rsComents_total
Dim rsComents_first
Dim rsComents_last

' set the record count
rsComents_total = rsComents.RecordCount

' set the number of rows displayed on this page
If (rsComents_numRows < 0) Then
  rsComents_numRows = rsComents_total
Elseif (rsComents_numRows = 0) Then
  rsComents_numRows = 1
End If

' set the first and last displayed record
rsComents_first = 1
rsComents_last  = rsComents_first + rsComents_numRows - 1

' if we have the correct record count, check the other stats
If (rsComents_total <> -1) Then
  If (rsComents_first > rsComents_total) Then
    rsComents_first = rsComents_total
  End If
  If (rsComents_last > rsComents_total) Then
    rsComents_last = rsComents_total
  End If
  If (rsComents_numRows > rsComents_total) Then
    rsComents_numRows = rsComents_total
  End If
End If
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim rsTotalPost_total
Dim rsTotalPost_first
Dim rsTotalPost_last

' set the record count
rsTotalPost_total = rsTotalPost.RecordCount

' set the number of rows displayed on this page
If (rsTotalPost_numRows < 0) Then
  rsTotalPost_numRows = rsTotalPost_total
Elseif (rsTotalPost_numRows = 0) Then
  rsTotalPost_numRows = 1
End If

' set the first and last displayed record
rsTotalPost_first = 1
rsTotalPost_last  = rsTotalPost_first + rsTotalPost_numRows - 1

' if we have the correct record count, check the other stats
If (rsTotalPost_total <> -1) Then
  If (rsTotalPost_first > rsTotalPost_total) Then
    rsTotalPost_first = rsTotalPost_total
  End If
  If (rsTotalPost_last > rsTotalPost_total) Then
    rsTotalPost_last = rsTotalPost_total
  End If
  If (rsTotalPost_numRows > rsTotalPost_total) Then
    rsTotalPost_numRows = rsTotalPost_total
  End If
End If
%>


<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (rsComents_total = -1) Then

  ' count the total records by iterating through the recordset
  rsComents_total=0
  While (Not rsComents.EOF)
    rsComents_total = rsComents_total + 1
    rsComents.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (rsComents.CursorType > 0) Then
    rsComents.MoveFirst
  Else
    rsComents.Requery
  End If

  ' set the number of rows displayed on this page
  If (rsComents_numRows < 0 Or rsComents_numRows > rsComents_total) Then
    rsComents_numRows = rsComents_total
  End If

  ' set the first and last displayed record
  rsComents_first = 1
  rsComents_last = rsComents_first + rsComents_numRows - 1
  
  If (rsComents_first > rsComents_total) Then
    rsComents_first = rsComents_total
  End If
  If (rsComents_last > rsComents_total) Then
    rsComents_last = rsComents_total
  End If

End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (rsTotalPost_total = -1) Then

  ' count the total records by iterating through the recordset
  rsTotalPost_total=0
  While (Not rsTotalPost.EOF)
    rsTotalPost_total = rsTotalPost_total + 1
    rsTotalPost.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (rsTotalPost.CursorType > 0) Then
    rsTotalPost.MoveFirst
  Else
    rsTotalPost.Requery
  End If

  ' set the number of rows displayed on this page
  If (rsTotalPost_numRows < 0 Or rsTotalPost_numRows > rsTotalPost_total) Then
    rsTotalPost_numRows = rsTotalPost_total
  End If

  ' set the first and last displayed record
  rsTotalPost_first = 1
  rsTotalPost_last = rsTotalPost_first + rsTotalPost_numRows - 1
  
  If (rsTotalPost_first > rsTotalPost_total) Then
    rsTotalPost_first = rsTotalPost_total
  End If
  If (rsTotalPost_last > rsTotalPost_total) Then
    rsTotalPost_last = rsTotalPost_total
  End If

End If
%>
<%
down = replace(rsMostra("download"), VbCrLf, "<br>")
%>
<%
info = replace(rsMostra("informações"), chr(13), "<br>")
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script src="../comuns.js"></script>
<script src="../home.js"></script>
<link href="../propriedades/css/geral.css" rel="stylesheet" type="text/css">
</head>
<script>
function coments(){
window.open('comentarios/coments.asp?a=<%=(rsMostra.Fields.Item("idDown").Value)%>','_blank','width=320,height=400,scrollbars=no')}
function down(){
window.open('comosefaz.asp','_blank','width=320,height=400,scrollbars=no')}
function erro(){
window.open('erro.asp?a=<%=(rsMostra.Fields.Item("idDown").Value)%>&u=<%=(rsPost.Fields.Item("id").Value)%>','_blank','width=320,height=400,scrollbars=no')}
</script>
<body>
<a href="<%= MM_Logout %>"></a>
<table width="777" border="0" cellspacing="2" cellpadding="0">
  <tr align="right">
    <td colspan="2" class="txt_menus">
      <a href="../indexUser.asp">Voltar a index</a> | <a href="<%= MM_Logout %>">Sair do Sistema</a></td>
  </tr>
    <tr>
    <td colspan="2">
	<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"><!--#include file="../includes/Topo.asp" --></td>
  </tr>
</table>
</td>
  </tr>
  <tr>
    <td width="171" valign="top"><!--#include file="../includes/Menu.asp"--></td>
    <td width="606" height="100%" valign="top">
	<script>Caixa1a(600,"","#003C6E","#FFFFFF","<%=(rsMostra.Fields.Item("categoria").Value)%>");</SCRIPT>
    <TABLE width="95%" align="center" cellPadding=0 cellSpacing=2 class="f7">
        <TBODY>
          <TR>
            <TD height="70" align="center">
              <table width="468" height="60" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="1" height="1" bgcolor="#cccccc"><img src="../propriedades/imagens/spacer.gif"></td>
                  <td class="brdMenuTop"><img src="../propriedades/imagens/spacer.gif"></td>
                  <td width="1" height="1" bgcolor="#cccccc"><img src="../propriedades/imagens/spacer.gif"></td>
                </tr>
                <tr>
                  <td class="brdMenuLeft"><img src="../propriedades/imagens/spacer.gif"></td>
                  <td height="50" align="center">
                    <script type="text/javascript"><!--
google_ad_client = "pub-9731414285654763";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "CCCCCC";
google_color_bg = "FFFFFF";
google_color_link = "000000";
google_color_url = "666666";
google_color_text = "333333";
//--></script>
                    <script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
      </script>
                  </td>
                  <td class="brdMenuRight"><img src="../propriedades/imagens/spacer.gif"></td>
                </tr>
                <tr>
                  <td height="1" bgcolor="#cccccc"><img src="../propriedades/imagens/spacer.gif"></td>
                  <td class="brdMenuBottom"><img src="../propriedades/imagens/spacer.gif"></td>
                  <td bgcolor="#cccccc"><img src="../propriedades/imagens/spacer.gif"></td>
                </tr>
            </table></TD>
          </TR>
          <TR>
            <TD>
              <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="30" align="center" class="txt_laranja"><%=(rsMostra.Fields.Item("nome").Value)%></td>
                </tr>
                <tr>
                  <td height="20" align="center" class="txt_menus"><img src="<%=(rsMostra.Fields.Item("img").Value)%>"></td>
                </tr>
                <tr>
                  <td height="20" class="txt_menus"><%Response.Write info%></td>
                </tr>
                <tr>
                  <td height="70" class="txt_menus">Tipo: <%=(rsMostra.Fields.Item("categoria").Value)%><br>      
      Views: <%=(rsMostra.Fields.Item("views").Value)%></td>
                </tr>
                <tr>
                  <td height="40" align="center" class="txt_menus"><strong>Download:</strong><br>
                      <%Response.Write down%></td>
                </tr>
                <tr>
                  <td height="100" align="center" valign="bottom" class="txt_menus"><a href="http://www.legendasbrasil.com.br/html/modules.php?name=Downloads&d_op=search&query=<%=(rsMostra.Fields.Item("nome").Value)%>" target="_blank">Se esse arquivo n&atilde;o &eacute; dublado e n&atilde;o tem legenda clike aqui para procurar uma legenda </a>
                      <hr width="98%" size="1" color="#CCCCCC">
                      <table border="0" cellspacing="0" cellpadding="0">
                        <tr align="center">
                          <td width="150"><a href="javascript:coments();"><img src="../propriedades/imagens/buttons/coments.gif" width="40" height="34" border="0"></a></td>
                          <td width="150"><a href="javascript:down();"><img src="../propriedades/imagens/buttons/comofaz.gif" width="40" height="36" border="0"></a></td>
                          <td width="150"><a href="javascript:erro();"><img src="../propriedades/imagens/buttons/link.gif" width="40" height="40" border="0"></a></td>
                        </tr>
                        <tr align="center" class="txt_cinza">
                          <td height="20"><strong><a href="javascript:coments();">Coment&aacute;rios (<strong><%=(rsComents_total)%></strong>)</a> </strong></td>
                          <td height="20"><a href="javascript:down();"><strong>Como fazer o download </strong></a></td>
                          <td height="20"><strong><a href="javascript:erro();">Reportar erro do link</a> </strong></td>
                        </tr>
                    </table></td>
                </tr>
              </table></TD>
          </TR>
          <tr>
            <td height="20" align="center" class="txt_menus"><a href="javascript:history.back();">Voltar</a></td>
          </tr>
        </TBODY>
      </TABLE>
<script>Caixa1f();</SCRIPT>
   </td>
  </tr>
  <tr>
    <td colspan="2"><!--#include file="../includes/Rodape.asp" --></td>
  </tr>
</table>
</body>
</html>
<%
rsUser.Close()
Set rsUser = Nothing
%>
<%
rsMostra.Close()
Set rsMostra = Nothing
%>
<%
rsPost.Close()
Set rsPost = Nothing
%>
<%
rsComents.Close()
Set rsComents = Nothing
%>
<%
rsTotalPost.Close()
Set rsTotalPost = Nothing
%>
COLOR=red]Já testei deste jeito também, não funcionou, e só funcionou a ultima substituição! ([[ por abc) :
<%@LANGUAGE="VBSCRIPT"%>
<%
' *** 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 = "../index.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/conectaSite.asp" -->
<%

if(Request.QueryString("a") <> "") then spRedirect__varID = Request.QueryString("a")

%>

<%

set spRedirect = Server.CreateObject("ADODB.Command")
spRedirect.ActiveConnection = MM_conectaSite_STRING
spRedirect.CommandText = "UPDATE conteudo SET views = views + 1  WHERE idDown = " + Replace(spRedirect__varID, "'", "''") + " "
spRedirect.CommandType = 1
spRedirect.CommandTimeout = 0
spRedirect.Prepared = true
spRedirect.Execute()
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="../users/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
%>
<%
Dim rsUser__MMColParam
rsUser__MMColParam = "1"
If (Session("MM_Username") <> "") Then 
  rsUser__MMColParam = Session("MM_Username")
End If
%>
<%
Dim rsUser
Dim rsUser_numRows

Set rsUser = Server.CreateObject("ADODB.Recordset")
rsUser.ActiveConnection = MM_conectaSite_STRING
rsUser.Source = "SELECT * FROM users WHERE login = '" + Replace(rsUser__MMColParam, "'", "''") + "'"
rsUser.CursorType = 0
rsUser.CursorLocation = 2
rsUser.LockType = 1
rsUser.Open()

rsUser_numRows = 0
%>
<%
Dim rsMostra__MMColParam
rsMostra__MMColParam = "1"
If (Request.QueryString("a") <> "") Then 
  rsMostra__MMColParam = Request.QueryString("a")
End If
%>
<%
Dim rsMostra
Dim rsMostra_numRows

Set rsMostra = Server.CreateObject("ADODB.Recordset")
rsMostra.ActiveConnection = MM_conectaSite_STRING
rsMostra.Source = "SELECT * FROM conteudo WHERE idDown = " + Replace(rsMostra__MMColParam, "'", "''") + ""
rsMostra.CursorType = 0
rsMostra.CursorLocation = 2
rsMostra.LockType = 1
rsMostra.Open()

rsMostra_numRows = 0
%>
<%
Dim rsPost__MMColParam
rsPost__MMColParam = "1"
If (Request.QueryString("u") <> "") Then 
  rsPost__MMColParam = Request.QueryString("u")
End If
%>
<%
Dim rsPost
Dim rsPost_numRows

Set rsPost = Server.CreateObject("ADODB.Recordset")
rsPost.ActiveConnection = MM_conectaSite_STRING
rsPost.Source = "SELECT * FROM users WHERE id = " + Replace(rsPost__MMColParam, "'", "''") + ""
rsPost.CursorType = 0
rsPost.CursorLocation = 2
rsPost.LockType = 1
rsPost.Open()

rsPost_numRows = 0
%>
<%
Dim rsComents__MMColParam
rsComents__MMColParam = "1"
If (Request.QueryString("a") <> "") Then 
  rsComents__MMColParam = Request.QueryString("a")
End If
%>
<%
Dim rsComents
Dim rsComents_numRows

Set rsComents = Server.CreateObject("ADODB.Recordset")
rsComents.ActiveConnection = MM_conectaSite_STRING
rsComents.Source = "SELECT * FROM coments WHERE idDown = " + Replace(rsComents__MMColParam, "'", "''") + ""
rsComents.CursorType = 0
rsComents.CursorLocation = 2
rsComents.LockType = 1
rsComents.Open()

rsComents_numRows = 0
%>
<%
Dim rsTotalPost__MMColParam
rsTotalPost__MMColParam = "1"
If (Request.QueryString("u") <> "") Then 
  rsTotalPost__MMColParam = Request.QueryString("u")
End If
%>
<%
Dim rsTotalPost
Dim rsTotalPost_numRows

Set rsTotalPost = Server.CreateObject("ADODB.Recordset")
rsTotalPost.ActiveConnection = MM_conectaSite_STRING
rsTotalPost.Source = "SELECT * FROM conteudo WHERE idUser = " + Replace(rsTotalPost__MMColParam, "'", "''") + ""
rsTotalPost.CursorType = 0
rsTotalPost.CursorLocation = 2
rsTotalPost.LockType = 1
rsTotalPost.Open()

rsTotalPost_numRows = 0
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim rsComents_total
Dim rsComents_first
Dim rsComents_last

' set the record count
rsComents_total = rsComents.RecordCount

' set the number of rows displayed on this page
If (rsComents_numRows < 0) Then
  rsComents_numRows = rsComents_total
Elseif (rsComents_numRows = 0) Then
  rsComents_numRows = 1
End If

' set the first and last displayed record
rsComents_first = 1
rsComents_last  = rsComents_first + rsComents_numRows - 1

' if we have the correct record count, check the other stats
If (rsComents_total <> -1) Then
  If (rsComents_first > rsComents_total) Then
    rsComents_first = rsComents_total
  End If
  If (rsComents_last > rsComents_total) Then
    rsComents_last = rsComents_total
  End If
  If (rsComents_numRows > rsComents_total) Then
    rsComents_numRows = rsComents_total
  End If
End If
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim rsTotalPost_total
Dim rsTotalPost_first
Dim rsTotalPost_last

' set the record count
rsTotalPost_total = rsTotalPost.RecordCount

' set the number of rows displayed on this page
If (rsTotalPost_numRows < 0) Then
  rsTotalPost_numRows = rsTotalPost_total
Elseif (rsTotalPost_numRows = 0) Then
  rsTotalPost_numRows = 1
End If

' set the first and last displayed record
rsTotalPost_first = 1
rsTotalPost_last  = rsTotalPost_first + rsTotalPost_numRows - 1

' if we have the correct record count, check the other stats
If (rsTotalPost_total <> -1) Then
  If (rsTotalPost_first > rsTotalPost_total) Then
    rsTotalPost_first = rsTotalPost_total
  End If
  If (rsTotalPost_last > rsTotalPost_total) Then
    rsTotalPost_last = rsTotalPost_total
  End If
  If (rsTotalPost_numRows > rsTotalPost_total) Then
    rsTotalPost_numRows = rsTotalPost_total
  End If
End If
%>


<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (rsComents_total = -1) Then

  ' count the total records by iterating through the recordset
  rsComents_total=0
  While (Not rsComents.EOF)
    rsComents_total = rsComents_total + 1
    rsComents.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (rsComents.CursorType > 0) Then
    rsComents.MoveFirst
  Else
    rsComents.Requery
  End If

  ' set the number of rows displayed on this page
  If (rsComents_numRows < 0 Or rsComents_numRows > rsComents_total) Then
    rsComents_numRows = rsComents_total
  End If

  ' set the first and last displayed record
  rsComents_first = 1
  rsComents_last = rsComents_first + rsComents_numRows - 1
  
  If (rsComents_first > rsComents_total) Then
    rsComents_first = rsComents_total
  End If
  If (rsComents_last > rsComents_total) Then
    rsComents_last = rsComents_total
  End If

End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (rsTotalPost_total = -1) Then

  ' count the total records by iterating through the recordset
  rsTotalPost_total=0
  While (Not rsTotalPost.EOF)
    rsTotalPost_total = rsTotalPost_total + 1
    rsTotalPost.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (rsTotalPost.CursorType > 0) Then
    rsTotalPost.MoveFirst
  Else
    rsTotalPost.Requery
  End If

  ' set the number of rows displayed on this page
  If (rsTotalPost_numRows < 0 Or rsTotalPost_numRows > rsTotalPost_total) Then
    rsTotalPost_numRows = rsTotalPost_total
  End If

  ' set the first and last displayed record
  rsTotalPost_first = 1
  rsTotalPost_last = rsTotalPost_first + rsTotalPost_numRows - 1
  
  If (rsTotalPost_first > rsTotalPost_total) Then
    rsTotalPost_first = rsTotalPost_total
  End If
  If (rsTotalPost_last > rsTotalPost_total) Then
    rsTotalPost_last = rsTotalPost_total
  End If

End If
%>
<%
down = replace(rsMostra("download"), VbCrLf, "<br>")
down = replace(rsMostra("download"), "[[", "abc")
%>
<%
info = replace(rsMostra("informações"), chr(13), "<br>")
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script src="../comuns.js"></script>
<script src="../home.js"></script>
<link href="../propriedades/css/geral.css" rel="stylesheet" type="text/css">
</head>
<script>
function coments(){
window.open('comentarios/coments.asp?a=<%=(rsMostra.Fields.Item("idDown").Value)%>','_blank','width=320,height=400,scrollbars=no')}
function down(){
window.open('comosefaz.asp','_blank','width=320,height=400,scrollbars=no')}
function erro(){
window.open('erro.asp?a=<%=(rsMostra.Fields.Item("idDown").Value)%>&u=<%=(rsPost.Fields.Item("id").Value)%>','_blank','width=320,height=400,scrollbars=no')}
</script>
<body>
<a href="<%= MM_Logout %>"></a>
<table width="777" border="0" cellspacing="2" cellpadding="0">
  <tr align="right">
    <td colspan="2" class="txt_menus">
      <a href="../indexUser.asp">Voltar a index</a> | <a href="<%= MM_Logout %>">Sair do Sistema</a></td>
  </tr>
    <tr>
    <td colspan="2">
	<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"><!--#include file="../includes/Topo.asp" --></td>
  </tr>
</table>
</td>
  </tr>
  <tr>
    <td width="171" valign="top"><!--#include file="../includes/Menu.asp"--></td>
    <td width="606" height="100%" valign="top">
	<script>Caixa1a(600,"","#003C6E","#FFFFFF","<%=(rsMostra.Fields.Item("categoria").Value)%>");</SCRIPT>
    <TABLE width="95%" align="center" cellPadding=0 cellSpacing=2 class="f7">
        <TBODY>
          <TR>
            <TD height="70" align="center">
              <table width="468" height="60" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="1" height="1" bgcolor="#cccccc"><img src="../propriedades/imagens/spacer.gif"></td>
                  <td class="brdMenuTop"><img src="../propriedades/imagens/spacer.gif"></td>
                  <td width="1" height="1" bgcolor="#cccccc"><img src="../propriedades/imagens/spacer.gif"></td>
                </tr>
                <tr>
                  <td class="brdMenuLeft"><img src="../propriedades/imagens/spacer.gif"></td>
                  <td height="50" align="center">
                    <script type="text/javascript"><!--
google_ad_client = "pub-9731414285654763";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "CCCCCC";
google_color_bg = "FFFFFF";
google_color_link = "000000";
google_color_url = "666666";
google_color_text = "333333";
//--></script>
                    <script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
      </script>
                  </td>
                  <td class="brdMenuRight"><img src="../propriedades/imagens/spacer.gif"></td>
                </tr>
                <tr>
                  <td height="1" bgcolor="#cccccc"><img src="../propriedades/imagens/spacer.gif"></td>
                  <td class="brdMenuBottom"><img src="../propriedades/imagens/spacer.gif"></td>
                  <td bgcolor="#cccccc"><img src="../propriedades/imagens/spacer.gif"></td>
                </tr>
            </table></TD>
          </TR>
          <TR>
            <TD>
              <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="30" align="center" class="txt_laranja"><%=(rsMostra.Fields.Item("nome").Value)%></td>
                </tr>
                <tr>
                  <td height="20" align="center" class="txt_menus"><img src="<%=(rsMostra.Fields.Item("img").Value)%>"></td>
                </tr>
                <tr>
                  <td height="20" class="txt_menus"><%Response.Write info%></td>
                </tr>
                <tr>
                  <td height="70" class="txt_menus">Tipo: <%=(rsMostra.Fields.Item("categoria").Value)%><br>      
      Views: <%=(rsMostra.Fields.Item("views").Value)%></td>
                </tr>
                <tr>
                  <td height="40" align="center" class="txt_menus"><strong>Download:</strong><br>
                      <%Response.Write down%></td>
                </tr>
                <tr>
                  <td height="100" align="center" valign="bottom" class="txt_menus"><a href="http://www.legendasbrasil.com.br/html/modules.php?name=Downloads&d_op=search&query=<%=(rsMostra.Fields.Item("nome").Value)%>" target="_blank">Se esse arquivo n&atilde;o &eacute; dublado e n&atilde;o tem legenda clike aqui para procurar uma legenda </a>
                      <hr width="98%" size="1" color="#CCCCCC">
                      <table border="0" cellspacing="0" cellpadding="0">
                        <tr align="center">
                          <td width="150"><a href="javascript:coments();"><img src="../propriedades/imagens/buttons/coments.gif" width="40" height="34" border="0"></a></td>
                          <td width="150"><a href="javascript:down();"><img src="../propriedades/imagens/buttons/comofaz.gif" width="40" height="36" border="0"></a></td>
                          <td width="150"><a href="javascript:erro();"><img src="../propriedades/imagens/buttons/link.gif" width="40" height="40" border="0"></a></td>
                        </tr>
                        <tr align="center" class="txt_cinza">
                          <td height="20"><strong><a href="javascript:coments();">Coment&aacute;rios (<strong><%=(rsComents_total)%></strong>)</a> </strong></td>
                          <td height="20"><a href="javascript:down();"><strong>Como fazer o download </strong></a></td>
                          <td height="20"><strong><a href="javascript:erro();">Reportar erro do link</a> </strong></td>
                        </tr>
                    </table></td>
                </tr>
              </table></TD>
          </TR>
          <tr>
            <td height="20" align="center" class="txt_menus"><a href="javascript:history.back();">Voltar</a></td>
          </tr>
        </TBODY>
      </TABLE>
<script>Caixa1f();</SCRIPT>
   </td>
  </tr>
  <tr>
    <td colspan="2"><!--#include file="../includes/Rodape.asp" --></td>
  </tr>
</table>
</body>
</html>
<%
rsUser.Close()
Set rsUser = Nothing
%>
<%
rsMostra.Close()
Set rsMostra = Nothing
%>
<%
rsPost.Close()
Set rsPost = Nothing
%>
<%
rsComents.Close()
Set rsComents = Nothing
%>
<%
rsTotalPost.Close()
Set rsTotalPost = Nothing
%>

Link to post
Share on other sites
  • 0

O teste que eu te passei funciona sim pois eu rodei aqui e normal! dry.gif

Quanto ao código, nem tem como olhar, muito grande. Talvez o que esteja acontecendo é que <br> não está aparecendo pra vc, mas troca.. uma forma de conferir é fazer em vez de VbCrLf por <br> é qualquer letra por outra letra, se funcionar é isso que eu te disse, você não ve o <br> mas ele está sendo substituído.

Link to post
Share on other sites
  • 0

Na verdade Andreia você está dando o primeiro replace no campo do recordset, e o segundo também... No caso ele substitui, mais só irá mostrar o último... Basta dar replace na variável a partir do segundo ítem:

variavel = Replace(rs("campo"),VbCrLf,"<br>")

variavel = Replace(variavel,"[[","abc")

No caso do Andre Luiz, troque isso:

down = replace(rsMostra("download"), VbCrLf, "<br>")

down = replace(rsMostra("download"), "[[", "abc")

por isso:

down = replace(rsMostra("download"), VbCrLf, "<br>")

down = replace(down, "[[", "abc")

e peça pra imprimir o conteúdo da variável down

[]s!

Link to post
Share on other sites
  • 0

No caso se você fizer do modo q você disse no segundo post funciona...

Repare:

variavel ="texto[["

variavel = replace (variavel, "x","m")

variavel = replace (variavel, "[[","abc")

response.write variavel

No exemplo que você postou acima funciona, pois ele substitui o valor da variável, e na seguinte ele permanece, pois foi alterado em uma variável...

Agora assim não funciona:

variavel = replace (rs("campo"), "x","m")

variavel = replace (rs("campo"), "[[","abc")

response.write rs("campo")

Se você fizer um teste com o exemplo acima, ele não vai substituir nada, porque você dá o replace direto no campo do recordset, ele altera, mais somente na variável, não no campo do recordset. Na segunda linha, você dá novamente um replace no campo do recorset, mais o conteúdo do recordset foi puxado novamente, ou seja, ele veio como está cadastrado no BD, ignorando o primeiro replace!!! Ele somente vai manter o último, independente do número de replaces... No caso você tem que dar o primeiro replace no campo do recordset, e no proximo, dar o replace na própria variável!!!

PS.: Nesse segundo exemplo q postei aqui, repare q não vai substituir absolutamente nada!!! Se você mandar um: "response.write variavel" ele vai mostrar o replace somente do último replace!!!

[]s!

Edited by Bicicleta
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Cloud Computing


  • Forum Statistics

    • Total Topics
      148691
    • Total Posts
      644524
×
×
  • Create New...