Practica lorena rss

Page 1

qwertyuiopasdfghjklzxcvbnmqwertyui opasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer Programaciテウn de Aplicaciones tyuiopasdfghjklzxcvbnmqwertyuiopas Practica RSS dfghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq wertyuiopasdfghjklzxcvbnmqwertyuio pasdfghjklzxcvbnmqwertyuiopasdfghj klzxcvbnmqwertyuiopasdfghjklzxcvbn mqwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasdf ghjklzxcvbnmqwertyuiopasdfghjklzxc vbnmqwertyuiopasdfghjklzxcvbnmrty uiopasdfghjklzxcvbnmqwertyuiopasdf ghjklzxcvbnmqwertyuiopasdfghjklzxc LORENA ZUテ選GA REYES


RSS.html <!DOCTYPE html> <html> <head> //Se ponen los scripts para hacer el combo din谩mico dentro del head <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#SRSS").change(function(){ if($('#SRSS').val()!=0) $("#RSS").load("RSSLoad.php?rss="+$('#SRSS').val()); else $('#RSS').empty(); }); }); </script> </head> <body> //Se crea el combo dinamico <select id='SRSS'> <option value='0'>Selecciona RSS</option> //las opciones son los url de las paginas don dese requiere la informaci贸n. <option value='http://feeds.feedburner.com/cnnexpansion/portada?format=xml'>CNN


Expansión</option> <option value='http://www.milenio.com/rss'>Milenio</option> <option value='http://www.aztecanoticias.com.mx/rss/todas.xml'>Azteca Noticias</option> <option value='http://rss.televisa.com/noticieros/nacional.xml'>Esmas</option>

<option value='http://eleconomista.com.mx/ultimas-noticias/rss'>El economista</option> </select> <br /><br /> <div class="datagrid" id='RSS'></div> </body> </html>


RSS.php <?php //se reciben los valores $url = $_REQUEST['rss']; $rss = simplexml_load_file($url); if($rss){ $items = $rss->channel->item; $image = $rss->channel->image->url; echo '<img src='.$image.'> //Se crea la tabla con encabezados <table> <thead><tr><th>Titulo</th><th>Fecha</th><th>Contenido</th></tr></thead><tbody>'; $class=''; foreach($items as $item){ $title = $item->title; $link = $item->link; $published_on = $item->pubDate; $description = $item->description; $image = $item->image; ?> <tr class="<?php echo $class ?>"> <td><?php echo '<a href="'.$link.'">'.$title.'</a>'; ?></td> <td><?php echo '<span>('.$published_on.')</span>'; ?></td> <td><?php echo '<p>'.$description.'</p>'; ?></td>


</tr> <?php if($class=='') $class='alt'; else $class=''; } echo "</tbody> </table>"; } ?>


Resultados



Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.