Ver Mensaje Individual
  #6 (permalink)  
Antiguo 10/04/2012, 09:46
charlescuellar
 
Fecha de Ingreso: abril-2008
Mensajes: 310
Antigüedad: 16 años
Puntos: 4
Respuesta: como ordenar resultado

claro disculpa

Código PHP:
Ver original
  1. <ul id="grid-content">  
  2.  
  3. <?php
  4.     $feedURL = "http://gdata.youtube.com/feeds/api/playlists/$playlistid?v=2&start-index=1&max-results=10";
  5.     // read feed into SimpleXML object
  6.     $sxml = simplexml_load_file($feedURL);
  7.  
  8.  
  9.       // get summary counts from opensearch: namespace
  10.     $counts = $sxml->children('http://a9.com/-/spec/opensearch/1.1/');
  11.     $total = $counts->totalResults;  
  12.  
  13.      // $sxml->children('http://a9.com/-/spec/opensearch/1.1/');
  14.      // $total = $sxml->totalResults;
  15.     $startIndex = $counts->startIndex;
  16.     $endOffset = ($startIndex-1) + $counts->itemsPerPage;
  17.      
  18. ?>
  19.  
  20.  
  21.      <h1> <?echo $sxml->title;?> </h1>
  22.    
  23.    <?php
  24.     // iterate over entries in feed
  25.     foreach ($sxml->entry as $entry) :
  26.       // get nodes in media: namespace for media information
  27.       $media = $entry->children('http://search.yahoo.com/mrss/');
  28.        
  29.       // get video player URL
  30.       $attrs = $media->group->player->attributes();
  31.       $watch = $attrs['url'];
  32.        
  33.       // get video thumbnail
  34.       $attrs = $media->group->thumbnail[0]->attributes();
  35.       $thumbnail = $attrs['url'];
  36.              
  37.       // get <yt:duration> node for video length
  38.       $yt = $media->children('http://gdata.youtube.com/schemas/2007');
  39.       $attrs = $yt->duration->attributes();
  40.       $length = $attrs['seconds'];
  41.        
  42.       // get <yt:stats> node for viewer statistics
  43.       $yt = $entry->children('http://gdata.youtube.com/schemas/2007');
  44.       $attrs = $yt->statistics->attributes();
  45.       $viewCount = $attrs['viewCount'];
  46.        
  47.       // get <gd:rating> node for video ratings
  48.       $gd = $entry->children('http://schemas.google.com/g/2005');
  49.       if ($gd->rating) {
  50.         $attrs = $gd->rating->attributes();
  51.         $rating = $attrs['average'];
  52.       } else {
  53.         $rating = 0;
  54.       }
  55.        
  56.  
  57.       // obtener <yt:videoId> node    
  58.       $yt = $media->children('http://gdata.youtube.com/schemas/2007');
  59.       $videoid = $yt->videoid;      
  60.  
  61.       // get <yt:duration> node for video length
  62.       $yt = $entry->children('http://gdata.youtube.com/schemas/2007');
  63.       $position = $yt->position;
  64.  
  65.  
  66.       ?>
  67.  
  68.  
  69.       <li>
  70.     <div class="view view-first">        
  71.           <? echo Html::link("index/ver/$videoid/$playlistid", "<img src=$thumbnail />") ;?>
  72.  
  73.      <div class="mask">
  74.      <h2 style="padding: 5px;"><?php echo Html::link("index/ver/$videoid/$playlistid", substr($media->group->title,0,20)) ?></h2>
  75.            <br> position :<? echo $position ?><br>
  76.  
  77.      <?php echo Html::link("index/ver/$videoid/$playlistid","Play","class='button .btn-danger'"); ?>
  78.      </div>        
  79.     </div>
  80.     </li>                      
  81.  
  82.  
  83.          
  84.    <?php  endforeach; ?>
  85.  
  86.  
  87. </ul>