Foros del Web » Programando para Internet » ASP Clásico »

Galeria de Videos ASP YouTuBe

Estas en el tema de Galeria de Videos ASP YouTuBe en el foro de ASP Clásico en Foros del Web. Hola a toda la comunidad. Por primera vez me veo entre la espada y la parde y he decido registrame, pero eso no quita que ...
  #1 (permalink)  
Antiguo 26/10/2009, 18:28
 
Fecha de Ingreso: octubre-2009
Mensajes: 11
Antigüedad: 14 años, 6 meses
Puntos: 0
Galeria de Videos ASP YouTuBe

Hola a toda la comunidad.

Por primera vez me veo entre la espada y la parde y he decido registrame, pero eso no quita que soy lector asiduo del portal. Así que gracias a todos desde ya por lo que me habeís enseñado.

-----------

Al grano !

Bueno La verdad que no soy ningún profesional intento apañarme mucho utilizando los códigos que la gente comparte y con los conocimientos que tengo intento hacerlo lo mejor que puedo.

Bien... la galería que he construido esta basada con el jQuery youtube playlist plugin - youtubeplaylist
***.geckonewmedia.com/blog/2009/8/14/jquery-youtube-playlist-plugin---youtubeplaylist

Mi trabajo ha sido integrarla con ASP, ciertamente funcionar me funciona, pero ahora mismo me da ciertos fallos que evidentemente no deberían de estar. Y estoy atorado sin saber muy bien por donde corregir, no se si el error lo tenga en la CSS, en el Javascript o si es fallo de ASP.

Supongo que a futuro, a alguien mas le puede interesar esta galería trabajada en ASP. Así que si me podéis echar un cable os lo agradezco. Si de paso alguno quiere optimizarla se agradecerá.

Aquí os dejo un enlace a la galería, para que la veáis en uso:
***.xtremexperience.es/videos.asp

Aquí os dejo la dirección donde os podéis descargar el ejemplo:
***.xtremexperience.es/ASPViga.rar
La css en el original la tengo ubicada en el fichero asp. En este va todo en sus carpetas.


Errores:

1º IE7 vs FF / No me carga Las Thumb's en su sitio, sospecho que se quedan debajo de la primera Thumb.

2º Cuando construyo el Bucle "Do While / Loop" tengo errores en el espaciado/salto de carro. He añadido 7 <br /> pero me parece un poco chapuzero. Y tampoco guarda las distancias por igual en FF vs IE7.

Bien en principio es eso. Gracias por vuestra ayuda de antemano.
--------------------------------------------------------------------------------------------------
Nota: * = w
  #2 (permalink)  
Antiguo 27/10/2009, 12:14
 
Fecha de Ingreso: octubre-2009
Mensajes: 11
Antigüedad: 14 años, 6 meses
Puntos: 0
Respuesta: Galeria de Videos ASP YouTuBe

Bueno aquí os dejo los Códigos:

NOTA: He vuelto a sustituir las tres w y el protocolo h t t p, por asteriscos:

File: videos.asp

Código asp:
Ver original
  1. <!-- [email protected] / J.E.J.R.-2009 -->
  2. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "****://***.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="****://***.w3.org/1999/xhtml">
  5. <head>
  6. <meta ****-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  7. <title>videos</title>
  8. <!-- Scripts -->
  9.     <script type="text/javascript" src="****://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
  10.     <script type="text/javascript" src="js/jquery.youtubeplaylist.js"></script>
  11.     <script type="text/ecmascript">
  12.             $(function() {
  13.                 $("div#demo").ytplaylist({addThumbs:true, autoPlay: false, holderId: 'video'});
  14.             });
  15.     </script>
  16. <!-- Estilos -->
  17. <link type="text/css" rel="stylesheet" href="css/aspviga.css" />
  18. </head>
  19. <!-- ////////////////////////////////////////////////// START ///////////////////////////////////////////////////////// -->
  20. <body>
  21. <!--  Universal -->
  22.     <div id="container">       
  23.         <div id="pag_n_up"></div>
  24.         <div id="pag_n_mid">
  25.         <!--  -->
  26. <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  27.         <%                 
  28.         ' Variables.
  29.             Dim SQL, oConn, RS
  30.             Dim v_id, v_link, v_titulo, v_seccion, v_describe
  31.             Dim Salto
  32.         'Asigno Variables.
  33.             v_id = "v_id"
  34.             v_link = "v_link"
  35.             v_titulo = "v_titulo"
  36.             v_seccion = "v_seccion"
  37.             v_describe = "v_describe"  
  38.             salto = Replace (cadena, vbCrLf, "<BR>")   
  39.         %>
  40.         <!-- VIDEOS -->
  41.                 <div id="master">
  42.                     <div id="visor">
  43.                         <div id="video"></div>
  44.                     </div>
  45.                     <div id="selector">
  46.                         <div>
  47.         <%
  48.         'Creamos la conexión a la base de datos sin DSN
  49.             Set oConn=Server.CreateObject("ADODB.Connection")
  50.                                                                    
  51.         'Conexión BASE DE DATOS ----- por OLEDB
  52.             oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("./db/xxx.mdb")&";" '
  53.            
  54.         'Ejecutamos la SELECT SQL.
  55.             SQL = "SELECT * FROM videos ORDER BY v_id DESC"
  56.            
  57.         'Creo un Recordset y ejecutamos la orden.
  58.             Set RS = oConn.Execute(SQL)
  59.            
  60.         'Recorre todas las filas del resultado
  61.             Do While Not RS.EOF
  62.         ' Muestra la fila actual
  63.         %>
  64.                                 <div id="caja">        
  65.                                     <div id="demo">
  66.                                         <p><a href="<% Response.Write(RS.Fields(v_link)) & vbCrlf %>"></a></p>                                                                         
  67.                                     </div>                             
  68.                                     <div id="propiedades">
  69.                                         <ul>
  70.                                             <li><strong>Video:&nbsp;</strong><span class="pist"><% Response.Write(RS.Fields(v_id)) %>º</span></li>
  71.                                             <li><strong>Secci&oacute;n:&nbsp;</strong><span class="pist"><% Response.Write(RS.Fields(v_seccion)) %></span></li>
  72.                                             <li><strong>Titulo:&nbsp;</strong><span class="pist"><% Response.Write(RS.Fields(v_titulo)) %></span></li>                                     
  73.                                         </ul>
  74.                                     </div>
  75.                                     <div id="descripcion">
  76.                                         <p><% Response.Write(RS.Fields(v_describe)) %></p>
  77.                                     </div>
  78.                                 </div>
  79.         <!-- Hack para Hacer el salto de pagina.  -->
  80.         <!-- Si no pongo los Br se quedan todas las cajas en una unica posicion -->
  81.         <br /><br /><br /><br /><br /><br /><br />                                 
  82.         <%
  83.         'Pasa a la siguiente fila
  84.             RS.MoveNext
  85.             Loop   
  86.         %>
  87.                         </div>
  88.                     </div>
  89.                 </div> 
  90.         <!-- VIDEOS -->                                
  91.         <%             
  92.         'Libera memoria
  93.             RS.Close
  94.             Set RS = Nothing
  95.             oConn.Close
  96.             Set oConn = Nothing
  97.            
  98.         'Cerramos variables
  99.             Set v_link = Nothing
  100.             Set v_titulo = Nothing
  101.             Set v_seccion = Nothing
  102.             Set v_describe = Nothing       
  103.         'FIN.
  104.         %>         
  105. <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->                   
  106.         <!--  -->
  107.         </div>
  108.         <div id="pag_n_down"></div>
  109.     </div>
  110. <!-- // Universal -->
  111. </body>
  112. <!-- /////////////////////////////////////////////////// END ///////////////////////////////////////////////////////// -->
  113. </html>


Este es el File aspviga.css.

Código css:
Ver original
  1. /* CSS Document */
  2.    
  3. /* UNIVERSALES PAGINAS */
  4. #container {
  5.     padding:0px;
  6.     margin:0px;
  7.     position:relative;
  8.     margin:0px auto;   
  9.     width:810px;
  10.     height:600px;
  11.     min-height:500px;
  12.     float:left;
  13.     }
  14. #pag_n_up {
  15.     padding:0px;
  16.     margin:0px;
  17.     position:relative;
  18.     background: url(img/pag_n_up.png) no-repeat;
  19.     width:810px;
  20.     height:5px;
  21.     }
  22. #pag_n_mid {
  23.     padding:0px;
  24.     margin:0px;
  25.     position:relative;
  26.     background: url(img/pag_n_mid.png) repeat-y;
  27.     width:810px;
  28.     height:550px;
  29.     }
  30. #pag_n_down {
  31.     padding:0px;
  32.     margin:0px;
  33.     position:relative;
  34.     background: url(img/pag_n_down.png) no-repeat;
  35.     width:810px;
  36.     height:5px;
  37.     }
  38.    
  39. /* VISOR VIDEOS */
  40. #master {
  41.     border:1px solid white;
  42.     background:#B2B2B2;
  43.     padding:0px;
  44.     margin:0px;
  45.     position:relative;
  46.     margin:5px;
  47.     width:800px;
  48.     height:420px;
  49.     float:left;
  50.     }
  51. #video {
  52.     }
  53. #visor { /* Este afecta al visualizador principal de los videos */
  54.     border:none;
  55.     background:;
  56.     margin:0px;
  57.     padding:10px;
  58.     width:500px;
  59.     height:400px;    
  60.     float:left;
  61.     position:relative;
  62.     }
  63. #selector { /* Este afecta a la lista de videos a reproducir */
  64.     border:none;
  65.     background:;
  66.     margin:0px;
  67.     padding:0px;
  68.     width:270px;
  69.     height:420px;
  70.     float:left;    
  71.     display:block;
  72.     position:relative;
  73.     overflow-y:scroll;
  74.     overflow-x:hidden; 
  75.     }
  76. #caja {
  77.     border:1px outset #B2B2B2;
  78.     background:#333333;
  79.     margin:5px;
  80.     padding:0px;
  81.     width:240px;
  82.     height:132px;
  83.     float:left;
  84.     position:absolute;
  85.     }
  86. #demo {
  87.     border:1px dotted #CCCCCC;
  88.     border-right:none;
  89.     margin:0px;
  90.     padding:0px;
  91.     width: 110px;
  92.     height:80px;
  93.     float: left;
  94.     }
  95. #demo p {  
  96.     margin:0;
  97.     padding:0;
  98.     }
  99. #demo p a {
  100.     }
  101. #demo p img { /*  */
  102.     border:none;
  103.     width:110px;
  104.     height:80px;
  105.     float: left;   
  106.     position:absolute;
  107.     }
  108. #propiedades { /*  */
  109.     background: #333333;
  110.     margin:0px;
  111.     padding:0px;
  112.     width: 122px;
  113.     height:80px;
  114.     float: left;
  115.     position:relative;
  116.     }
  117. #propiedades ul {  
  118.     border:1px dotted #CCCCCC;
  119.     border-left:none;
  120.     margin:0;
  121.     padding:9px 3px 3px 6px;/* arriba - derecha - abajo - izquierda */
  122.     width: 119px;
  123.     height:68px;
  124.     position:absolute;
  125.     }  
  126. #propiedades ul li {
  127.     font-family: Arial, Helvetica, sans-serif;
  128.     font-size:0.7em;
  129.     line-height:1.2em;
  130.     text-align:left;
  131.     color:#F0F0F0;
  132.     float:left;
  133.     list-style-type: none;
  134.     list-style:none;
  135.     }
  136. #descripcion {
  137.     border:1px outset #CCCCCC;
  138.     background:#F0F0F0;
  139.     margin:0px;
  140.     padding:1px 4px 1px 4px;/* arriba - derecha - abajo - izquierda */
  141.     width: 230px;
  142.     height:46px;
  143.     font-family: Arial, Helvetica, sans-serif;
  144.     font-size:0.8em;
  145.     line-height:1.2em;
  146.     text-align:left;
  147.     float: left;
  148.     }
  149. #descripcion p {
  150.     margin:0;
  151.     padding:0;
  152.     width: 228px;
  153.     height:46px;
  154.     position:absolute;
  155.     }
  156. .pist {
  157.     color: #CCFF00;
  158.     }
  159. .currentvideo {
  160.     background: #e6e6e6;
  161.     }
  162.  
  163. /* FIN */
  #3 (permalink)  
Antiguo 27/10/2009, 12:18
 
Fecha de Ingreso: octubre-2009
Mensajes: 11
Antigüedad: 14 años, 6 meses
Puntos: 0
Respuesta: Galeria de Videos ASP YouTuBe

Y por ultimo el archivo javascript que lo he modificado. cambiando etiquetas html.

Nota: También aquí he tenido que cambiar las 3 w y el protocolo por asteriscos.


Código javascript:
Ver original
  1. //-------------------------------------------------
  2. //      youtube playlist jquery plugin
  3. //      Created by [email protected]
  4. //      ***.geckonewmedia.com
  5. //-------------------------------------------------
  6.  
  7. jQuery.fn.ytplaylist = function(options) {
  8.  
  9.    // default settings
  10.   var options = jQuery.extend( {
  11.     holderId: 'video',
  12.     playerHeight: '400',
  13.     playerWidth: '500',
  14.     addThumbs: false,
  15.     thumbSize: 'small',
  16.     showInline: false,
  17.     autoPlay: true,
  18.     showRelated: false // true
  19.   },options);
  20.  
  21.   return this.each(function() {
  22.                            
  23.         var selector = $(this);
  24.        
  25.         var autoPlay = "";
  26.         var showRelated = "&rel=0";
  27.         if(options.autoPlay) autoPlay = "&autoplay=1";
  28.         if(options.showRelated) showRelated = "&rel=0";
  29.        
  30.         //throw a youtube player in
  31.         function play(id)
  32.         {
  33.            var html  = '';
  34.            
  35.            html += '<object height="'+options.playerHeight+'" width="'+options.playerWidth+'">';
  36.            html += '<param name="movie" value="****://***.youtube.com/v/'+id+autoPlay+showRelated+'"></param>';
  37.            html += '<param name="wmode" value="transparent"></param>';
  38.            html += '<embed src="****://***.youtube.com/v/'+id+autoPlay+showRelated+'" type="application/x-shockwave-flash" wmode="transparent"  height="'+options.playerHeight+'" width="'+options.playerWidth+'"></embed>';
  39.            html += '</object>';
  40.    
  41.            return html;
  42.         };
  43.        
  44.         //grab a youtube id from a (clean, no querystring)
  45.         function youtubeid(url) {
  46.             var ytid = url.match("[\\?&]v=([^&#]*)");
  47.             ytid = ytid[1];
  48.             return ytid;
  49.         };
  50.        
  51.        
  52.         //load inital video
  53.         var firstVid = selector.children("p:first-child").addClass("currentvideo").children("a").attr("href");
  54.         $("#"+options.holderId+"").html(play(youtubeid(firstVid)));
  55.        
  56.         //load video on request
  57.         selector.children("p").children("a").click(function() {
  58.            
  59.             if(options.showInline) {
  60.                 $("div.currentvideo").removeClass("currentvideo");
  61.                 $(this).parent("div").addClass("currentvideo").html(play(youtubeid($(this).attr("href"))));
  62.             }
  63.             else {
  64.                 $("#"+options.holderId+"").html(play(youtubeid($(this).attr("href"))));
  65.                 $(this).parent().parent("div").find("div.currentvideo").removeClass("currentvideo");
  66.                 $(this).parent("div").addClass("currentvideo");
  67.             }
  68.                                                              
  69.            
  70.            
  71.             return false;
  72.         });
  73.        
  74.         // jQuery Youtube plugin - jYouTube
  75.         if(options.addThumbs) {
  76.            
  77.             selector.children().each(function(i){
  78.                                              
  79.                 var replacedText = $(this).text();
  80.                
  81.                 if(options.thumbSize == 'small') {
  82.                     var thumbUrl = "****://img.youtube.com/vi/"+youtubeid($(this).children("a").attr("href"))+"/2.jpg";
  83.                 }
  84.                 else {
  85.                     var thumbUrl = "****://img.youtube.com/vi/"+youtubeid($(this).children("a").attr("href"))+"/0.jpg";
  86.                 }
  87.                
  88.                
  89.                 $(this).children("a").empty().html("<img src='"+thumbUrl+"' alt='"+replacedText+"' />"+replacedText).attr("title", replacedText);
  90.                
  91.             });
  92.            
  93.         }
  94.            
  95.        
  96.    
  97.   });
  98.  
  99. };
  #4 (permalink)  
Antiguo 20/07/2010, 05:42
 
Fecha de Ingreso: julio-2010
Ubicación: Zaragoza
Mensajes: 6
Antigüedad: 13 años, 9 meses
Puntos: 0
Respuesta: Galeria de Videos ASP YouTuBe

Cita:
Iniciado por Mexman Ver Mensaje
Y por ultimo el archivo javascript que lo he modificado. cambiando etiquetas html.

Nota: También aquí he tenido que cambiar las 3 w y el protocolo por asteriscos.


Código javascript:
Ver original
  1. //-------------------------------------------------
  2. //      youtube playlist jquery plugin
  3. //      Created by [email protected]
  4. //      ***.geckonewmedia.com
  5. //-------------------------------------------------
  6.  
  7. jQuery.fn.ytplaylist = function(options) {
  8.  
  9.    // default settings
  10.   var options = jQuery.extend( {
  11.     holderId: 'video',
  12.     playerHeight: '400',
  13.     playerWidth: '500',
  14.     addThumbs: false,
  15.     thumbSize: 'small',
  16.     showInline: false,
  17.     autoPlay: true,
  18.     showRelated: false // true
  19.   },options);
  20.  
  21.   return this.each(function() {
  22.                            
  23.         var selector = $(this);
  24.        
  25.         var autoPlay = "";
  26.         var showRelated = "&rel=0";
  27.         if(options.autoPlay) autoPlay = "&autoplay=1";
  28.         if(options.showRelated) showRelated = "&rel=0";
  29.        
  30.         //throw a youtube player in
  31.         function play(id)
  32.         {
  33.            var html  = '';
  34.            
  35.            html += '<object height="'+options.playerHeight+'" width="'+options.playerWidth+'">';
  36.            html += '<param name="movie" value="****://***.youtube.com/v/'+id+autoPlay+showRelated+'"></param>';
  37.            html += '<param name="wmode" value="transparent"></param>';
  38.            html += '<embed src="****://***.youtube.com/v/'+id+autoPlay+showRelated+'" type="application/x-shockwave-flash" wmode="transparent"  height="'+options.playerHeight+'" width="'+options.playerWidth+'"></embed>';
  39.            html += '</object>';
  40.    
  41.            return html;
  42.         };
  43.        
  44.         //grab a youtube id from a (clean, no querystring)
  45.         function youtubeid(url) {
  46.             var ytid = url.match("[\\?&]v=([^&#]*)");
  47.             ytid = ytid[1];
  48.             return ytid;
  49.         };
  50.        
  51.        
  52.         //load inital video
  53.         var firstVid = selector.children("p:first-child").addClass("currentvideo").children("a").attr("href");
  54.         $("#"+options.holderId+"").html(play(youtubeid(firstVid)));
  55.        
  56.         //load video on request
  57.         selector.children("p").children("a").click(function() {
  58.            
  59.             if(options.showInline) {
  60.                 $("div.currentvideo").removeClass("currentvideo");
  61.                 $(this).parent("div").addClass("currentvideo").html(play(youtubeid($(this).attr("href"))));
  62.             }
  63.             else {
  64.                 $("#"+options.holderId+"").html(play(youtubeid($(this).attr("href"))));
  65.                 $(this).parent().parent("div").find("div.currentvideo").removeClass("currentvideo");
  66.                 $(this).parent("div").addClass("currentvideo");
  67.             }
  68.                                                              
  69.            
  70.            
  71.             return false;
  72.         });
  73.        
  74.         // jQuery Youtube plugin - jYouTube
  75.         if(options.addThumbs) {
  76.            
  77.             selector.children().each(function(i){
  78.                                              
  79.                 var replacedText = $(this).text();
  80.                
  81.                 if(options.thumbSize == 'small') {
  82.                     var thumbUrl = "****://img.youtube.com/vi/"+youtubeid($(this).children("a").attr("href"))+"/2.jpg";
  83.                 }
  84.                 else {
  85.                     var thumbUrl = "****://img.youtube.com/vi/"+youtubeid($(this).children("a").attr("href"))+"/0.jpg";
  86.                 }
  87.                
  88.                
  89.                 $(this).children("a").empty().html("<img src='"+thumbUrl+"' alt='"+replacedText+"' />"+replacedText).attr("title", replacedText);
  90.                
  91.             });
  92.            
  93.         }
  94.            
  95.        
  96.    
  97.   });
  98.  
  99. };
Lo primero que tienes que hacer el poner entre comillas todos los rs.fields que sacas de la DD.BB. Es decir:
RS.Fields("v_describe") o RS.Fields("lo_que_sea")
  #5 (permalink)  
Antiguo 20/07/2010, 05:56
Avatar de Wasper  
Fecha de Ingreso: julio-2006
Ubicación: de cai, picha!!!
Mensajes: 1.030
Antigüedad: 17 años, 9 meses
Puntos: 41
Respuesta: Galeria de Videos ASP YouTuBe

Hola Elxus, aunque tu intencion ha sido muy buena, te digo que este post tiene casi un parto no se deben levantar post antiguos...
__________________
Saludos, Jose

Paginas web y SEO
Anuncios por palabras
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:55.