<% Dim strConnString, oConn, oRS, oFld Set oConn = Server.CreateObject("ADODB.Connection") strConnString = Application("conectar") oConn.Open strConnString %> Via News, tu página de noticias en Internet

<%if request.querystring("tipo") = "" Then%>

Bienvenidos a Via News, la sección de noticias de Comicvia donde podréis encontrar noticias relacionadas con el Comic, el Cine, el Rol, los Libros... Aceptamos sugerencias y noticias no reseñadas; cine, comic y opinión. Suscribete a nuestra Lista de Correo.

Agréganos a Favoritos
<%else%> <%select case request.querystring("tipo")%> <%case "1"%> <%case "2"%> <%case "3"%> <%case "4"%> <%end select%> <%end if %> <% cantidadregistros=12 if request.querystring("paginaactual") <> "" then mostrarpagina = request.querystring("paginaactual") else mostrarpagina = 1 end if if request.querystring("inicio") <> "" then sInicio = request.querystring("inicio") else sInicio = 1 end if if request.querystring("tipo") = "" Then Set registros = server.CreateObject("ADODB.recordset") registros.Open "SELECT * FROM vianewsnoticia ORDER BY id desc", oConn, 1, 1 else Set registros = server.CreateObject("ADODB.recordset") registros.Open "SELECT * FROM vianewsnoticia where tipo = " & request.querystring("tipo") & " ORDER BY id desc", oConn, 1, 1 end if 'registros.cachesize=60 'registros.pagesize=cantidadregistros 'maxpagina=cint(registros.pagecount) 'maxregistros=cint(registros.pagesize) 'registros.absolutepage=mostrarpagina 'contreg=0 'response.write registros.cachesize & "
" 'response.write registros.pagesize & "
" 'response.write maxpagina & "
" 'response.write maxregistros & "
" 'response.write registros.absolutepage & "
" 'response.write contreg=0 & "
" 'response.end '--------------- ' BUSQUEDA '--------------- if request.form("buscar") <> "" Then dim sBuscar sBuscar = request.form("buscar") 'function Sacar(cadena,campos) 'dim i 'dim SacarAux 'while InStr(cadena," ") ' Cadena=Replace(Cadena," "," ") 'wend 'if len(cadena)>0 then ' if InStr(cadena," ")>0 then ' Sacar= Sacar(left(cadena,InStr(cadena," ")-1),campos) & " OR " & Sacar(right(cadena,len(cadena)-InStr(cadena," ")),campos) ' elseif InStr(cadena,"+")>0 then ' Sacar=Sacar(left(cadena,InStr(cadena,"+")-1),campos) & " AND "& Sacar(right(cadena,len(cadena)-InStr(cadena,"+")),campos) ' elseif InStr(cadena,"-")>0 then ' Sacar=Sacar(left(cadena,InStr(cadena,"-")-1),campos) & " AND NOT " & Sacar(right(cadena,len(cadena)-InStr(cadena,"-")),campos) ' else ' 'fijamos la sentencia ' SacarAux="" ' i=1 ' SacarAux= "( " & campos(i) & " Like '%" & cadena & "%'" ' i=i+1 ' while len(campos(i))>0 ' SacarAux= SacarAux & " OR " & campos(i) & " Like '%" & cadena & "%'" ' i=i+1 ' wend ' SacarAux=SacarAux & " )" ' Sacar=SacarAux ' end if 'else 'sacar="" 'end if 'end function 'function GeneraSql(cadena,tabla,campos) 'if len(cadena)>0 then ' generaSql="Select top 12 * from " & tabla & " Where " & Sacar(cadena,campos) 'else ' Response.Write "No hay criterios" 'end if 'end function 'dim campos(4) 'el tamano del array debe superar en uno al numero de campos 'campos(1)="titulo" 'campos(2)="noticia" 'campos(3)="descripcion" 'para mostrar cual seria el resultado... 'cadena= request.form("buscar") ' AQUI VA EL NOMBRE DE LA TABLA. 'tabla="vianewsnoticia" 'resultado=GeneraSql(cadena,tabla,campos) 'resultado = resultado & " ORDER BY id desc" ' Set registros = server.CreateObject("ADODB.recordset") ' registros.Open resultado, oConn, 2, 2 'SELECT TOP 10 vianewsnoticia.titulo AS Titulo, vianewscomentarios.opinion AS Opinion, vianewscomentarios.mono AS Mono, ' vianewscomentarios.nombre AS Nombre, vianewsnoticia.descripcion AS Descripcion, vianewsnoticia.id AS Id 'FROM vianewscomentarios INNER JOIN ' vianewsnoticia ON vianewscomentarios.mono = vianewsnoticia.id 'if request.querystring("tipo") = "" Then Set registros = server.CreateObject("ADODB.recordset") 'sql = "SELECT vianewsnoticia.titulo AS Titulo, vianewscomentarios.opinion AS Opinion, vianewscomentarios.mono AS Mono, " 'sql = sql & " vianewscomentarios.nombre AS Nombre, vianewsnoticia.descripcion AS Descripcion, vianewsnoticia.id AS Id," 'sql = sql & " vianewsnoticia.tipo2, vianewsnoticia.autor, vianewsnoticia.fecha, vianewsnoticia.vistos" sql = " SELECT DISTINCT vianewscomentarios.mono AS id " sql = sql & " FROM vianewscomentarios INNER JOIN" sql = sql & " vianewsnoticia ON vianewscomentarios.mono = vianewsnoticia.id" sql = sql & " where (vianewsnoticia.titulo like('%" & sBuscar & "%')) " 'or (vianewscomentarios.opinion like('%" & sBuscar & "%')) sql = sql & " or (vianewscomentarios.mono like('%" & sBuscar & "%')) or (vianewscomentarios.nombre like('%" & sBuscar & "%'))" sql = sql & " or (vianewsnoticia.descripcion like('%" & sBuscar & "%'))" sql = sql & " order by mono desc" 'response.write sql registros.Open sql, oConn, 1, 1 'else ' Set registros = server.CreateObject("ADODB.recordset") ' registros.Open "SELECT * FROM vianewsnoticia where tipo = " & request.querystring("tipo") & " ORDER BY id desc", oConn, 1, 1 'end if end if if registros.eof then response.write "No hay resultados que mostrar" response.end end if registros.cachesize=60 registros.pagesize=cantidadregistros maxpagina=cint(registros.pagecount) maxregistros=cint(registros.pagesize) registros.absolutepage=mostrarpagina contreg=0 Do While Not registros.eof and contreg < maxregistros 'buscar los encontrados Set registros2 = server.CreateObject("ADODB.recordset") registros2.Open "SELECT * FROM vianewsnoticia where id =" & registros.Fields("id") & " ORDER BY id desc", oConn, 1, 1 %>

<%if registros2.Fields("tipo2").Value = "1" then%>
<%end if%> <%if registros2.Fields("tipo2").Value = "3" then%>
<%end if%> <%if registros2.Fields("tipo2").Value = "4" then%>
<%end if%> <%if registros2.Fields("tipo2").Value = "2" then%>
<%end if%> <%if registros2.Fields("tipo2").Value = "5" then%>
<%end if%>

<%= registros2("titulo") %>

<%= registros2("descripcion") %>
<%= registros2.Fields("autor").Value %> el <%= registros2.Fields("fecha").Value %> / <% Set numero = server.CreateObject("ADODB.recordset") numero.Open "select count(*) as num from vianewscomentarios where mono = " & registros2.Fields("id") & "",oConn,3,3 response.write numero("num") %> Comentarios / Veces Visto : <%= registros2.Fields("vistos").Value %> " target="_blank">')">

<% iId = registros.Fields("id") registros.MoveNext contreg=contreg+1 Loop %>
<% '******************* PAGINACION cero="0" nombrescript="" mostrar = 20 'mostrar para atras if int(sInicio)<>1 then ini = sInicio - mostrar ref="[|<] " end if if int(mostrarpagina)<>1 then '--si no es la primer página mostrar botón atrás ref=ref & "[<<<] " end if tope = sInicio + mostrar - 1 for contador=sInicio to tope If contador>9 then cero="" end if 'comprobar maximo paginas if not (contador > maxpagina) then ref=ref & " " & cero & contador & "" else ref=ref & "'>" & cero & contador & "" end if end if next if int(mostrarpagina)<>int(maxpagina) then '-- si no es la última página ' mostrar botón siguiente ref=ref & " [>>>]" end if 'mostrar para atras if (int(sInicio)) < (maxpagina-mostrar) then ini = sInicio + mostrar ref=ref & "[>|] " end if response.write ref %>
Subscribete a Via News
Servicio por groups.yahoo.com