Bem estou querendo fazer um painel rotativo igul ao do yahoo.
Neste site eu vi um sistema que eu poderia utilizar sem problemas, o código desse sitema é o mostrado abaixo. Só que ele pega as notícias do banco de dados MySQL, e eu gostaria que pegasse no Feed RSS, tem como ou não? Ajuda aew galera!
<html> <head> <title>S l i d e S h o w </title> <style><!-- * { margin: 0; padding: 0; list-style: none; text-decoration: none; font-family: Verdana, Arial, Helvetica, Sans-Serif; } div#slideshow { height: 250px; width: 466px; border: 1px solid black; } div#slideshow #links { float: right; clear: both; width: 10%; text-align: center; } div#slideshow #links li { font-size: 12px; border-top: 1px solid white; line-height: 49px; } div#slideshow #links li.inativo { background: #ffffff; } div#slideshow #links li.ativo { background: #6699cc; font-color: #FF6600; } div#slideshow #slides { background: #ffffff; height: 100%; color: white; font-size: 14px; } div#slideshow #slides .visible { display: block; } div#slideshow #slides .hidden { display: none; } div#slideshow #slides div span { display: block; } div#slideshow #slides .titulo{ font-weight: bold; font-size: 16px; padding: 5px 0 0 5px; } div#slideshow #slides .conteudo { padding: 0 0 0 5px; } --></style> <script type="text/javascript"> var tempo; var intervalo = 2000; //Intervalo entra as mudanças de slides. Definido em milisegundos. function $(campo) { return document.getElementById(campo); } //Trecho de código criado por Wilker, pego em http://forum.imasters.com.br/index.php?s= <http://forum.imasters.com.br/index.php?s=&showtopic=198704&view=findpost&p= 660522> &showtopic=198704&view=findpost&p=660522 var $A = Array.from = function(iterable) { if (!iterable) return []; if (iterable.toArray) { return iterable.toArray(); } else { var results = []; for (var i = 0; i < iterable.length; i++) results.push(iterable[i]); return results; } }; Function.prototype.bind = function() { var __method = this, args = $A(arguments), object = args.shift(); return function() { return __method.apply(object, args.concat($A(arguments))); }; }; //Fim do trecho de código criado por Wilker function addEvent(obj, evType, fn) { //Função adaptada da original de Christian Heilmann, em http://www.onlinetools.org/articles/unobtrusivejavascript/chapter4.html if (typeof obj == "string") { if (null == (obj = document.getElementById(obj))) { throw new Error("Elemento HTML não encontrado. Não foi possível adicionar o evento."); } } if (obj.attachEvent) { return obj.attachEvent(("on" + evType), fn); } else if (obj.addEventListener) { return obj.addEventListener(evType, fn, true); } else { throw new Error("Seu browser não suporta adição de eventos."); } } function nextSlide() { var divs = $('slides').getElementsByTagName('div'); var i; for (i = 0; i < divs.length; i++) { if (divs[i].className == 'visible') { divs[i].className = 'hidden'; $('link' + (i + 1)).className = 'inativo' i = (i == divs.length - 1) ? 0 : i + 1; divs[i].className = 'visible'; $('link' + (i + 1)).className = 'ativo' break; } } } function init() { var as = $('links').getElementsByTagName('a'); var i; for (i = 0; i < as.length; i++) { var f = function(v) { setSlide(as[v]); } addEvent(as[i], 'click', f.bind(this, i)); } tempo = setInterval('nextSlide()', intervalo); } function setSlide(link) { var divs = $('slides').getElementsByTagName('div'); var i; for (i = 0; i < divs.length; i++) { divs[i].className = 'hidden'; } var lis = $('links').getElementsByTagName('li'); for (i = 0; i < lis.length; i++) { lis[i].className = 'inativo'; } link.parentNode.className = 'ativo'; i = parseInt(link.firstChild.data); $('slide' + i).className = 'visible'; clearInterval(tempo); } addEvent(window, 'load', init); </script> </head> <body> <div id="slideshow" name="slideshow"> <div id="links" name="links"> <ul> <?php $sql = mysql_query("SELECT * FROM noticias_dados where destaque='sim' order by id desc LIMIT 5"); $sql2 = mysql_query("SELECT * FROM noticias_dados where destaque='sim' order by id desc LIMIT 5"); $i=1; $class="ativo"; while($mostrar = mysql_fetch_assoc($sql)) { echo "<li id=link$i name=link$i class=$class><a href=#>$i</a></li>"; ?> <? $i++; $class="inativo";} ?> </ul> </div> <div id="slides" name="slides"> <?php $sql2 = mysql_query("SELECT * FROM noticias_dados where destaque='sim' order by id desc LIMIT 5"); $class="visible"; $j=1; while($dados2=mysql_fetch_array($sql2)) { echo "<div id=slide$j name=slide$j class=$class> <font size='4' color='#6699cc'><strong>$dados2[titulo]</strong></font><br>"; ?> <? $r1=$mostrar2['texto']; $r12= substr($r1, 0,400); echo "<a href='?pg=noticia&id=$dados2[id]'><img vspace='2' src='thumbs.php?w=$largura&h=$altura&imagem=images/noticias/$dados2[id]/$dad os2[foto01]' border='$dados2[borda]'><br><font size='2' color='#6699cc'><strong>$dados2[subtitulo]</strong></font></a></p></span> </div>"; ?> <? $j++; $class="hidden"; } ?> </div> </div> </body> </html>
Valeu aí galera desde já agradecido!
Edição feita por: Teteu Web, 03/02/2009, 09:58.