|
|
 |





 |
 |
 |
 |
<%
Dim valoracion
Id = Request.QueryString("Id")
Set oConn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.RecordSet")
oConn.Open "w00294862_bd1"
'si no hay id muestra la ultima noticia
If Request.QueryString("Id")= "" then
sql = "SELECT * FROM noticias ORDER BY Fecha DESC"
else
sql = "SELECT * FROM noticias WHERE Id="&Id&""
End If
Rs.Open sql, oConn, 1, 1
contenido = RS("contenido")
valoracion=CInt(RS("total")/RS("votos")+10)
'=== Muestro el mensaje padre. La pregunta inicial ======
Response.Write "| "&RS("Titulo")&" | "
Response.Write "
"& AcomodarTXT(contenido)&" "
Response.Write " |  | "
Response.Write " "&RS("nombre")&" ![]() "&RS("fecha")&" "
Response.Write "valoración: "&(valoracion)&"% "
Response.Write " |    | "
Response.Write " "
'===== Fin pregunta inicial =====
RS.Close
oConn.Close
Set RS = nothing
Set oConn = nothing
Function AcomodarTXT(txt)
txt = Replace (txt, "<", "<")
txt = Replace (txt, ">", ">")
txt = Replace (txt, vbCrLf, " ")
txt = Replace (txt, "''", "'")
acomodarTXT = txt
End function
%>
|
|
|
|
|
 |
 |
 |
 |
MÁS NOTICIAS
<%
Dim oConn, RS, mostrar, pag_totales, pag_actual
'Conectamos a la BD.
Set oConn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.RecordSet")
oConn.Open "w00294862_bd1"
sql = "SELECT * FROM noticias ORDER BY Fecha DESC"
RS.Open sql, oConn,3,1
mostrar = 10
rs.PageSize = mostrar
rs.CacheSize = mostrar
if Request.Querystring("pagina")="" then
pag_actual=1
else
pag_actual=CInt(Request.Querystring("pagina"))
end if
pag_totales = rs.PageCount
if pag_actual < 1 then
pag_actual = 1
end if
if pag_actual > pag_totales then
pag_actual = pag_totales
end if
if pag_totales=0 then
Response.Write("No hay NOTICIAS.")
else
rs.AbsolutePage = pag_actual
Response.Write("Página " & Pag_actual & " de " & pag_totales &"
")
cant_registros = 0
if pag_actual > 1 then
Response.Write("Noticias Nuevas
")
end if
if pag_actual < pag_totales then
Response.Write("Noticias anteriores
")
end if
do while not rs.EOF and cant_registros < mostrar
fecha = RS("Fecha")%>|
" CLASS="P"><%=(RS.Fields("Titulo"))%> | <%=(RS.Fields("nombre"))%>
<% Response.Write " | " &Day(fecha)&"/"&Month(fecha)&"
| "
cant_registros = cant_registros +1
RS.MoveNext
Loop
end if
RS.Close
oConn.Close
Set RS = nothing
Set oConn = nothing
%>
|
 |
 |
 |
 |
 |
 |
 |
|



|
|
 |
|