sedex 0 Denunciar post Postado Janeiro 25, 2008 Pessoal, to tentando adaptar um sistema de slide de notícias igual ao que existia no imasters. Mas quando tento colocar uma include ou um código qualquer dentro da div que deve ser atualizada, aparece o seguinte erro: Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 Fatal error: Unknown: Failed opening required 'C:/AppServ/www/DISPLAY DE NOTÃCIAS/index.php' (include_path='.;C:\php5\pear') in Unknown on line 0 Alguém saberia como contornar essa situação, ou indicaria um script com banco de dados? Eu ja instalei o do Bimonti, mas o dele não tem páginação, apenas próximo e anterior, como o do site da UOL. Os arquivos que eu to utilizando são os seguintes: index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Sistema de Notícia em Slide Show</title> <link rel="stylesheet" type="text/css" href="contentslider.css" /> <script type="text/javascript" src="contentslider.js"> </script> </head> <body> <div id="slider1" class="contentslide"> <div class="contentdiv"> <?php include("arquivo1.php"); ?> </div> <div class="contentdiv"> <?php include("arquivo2.php"); ?> </div> <div class="contentdiv"> <?php include("arquivo3.php"); ?> </div> </div> <div class="pagination" id="paginate-slider1"></div> <script type="text/javascript"> //Define: ContentSlider("slider_ID", [autorotate_miliseconds], [custompaginatelinkstext], [customnextlinktext]) //OR ContentSlider("slider1") ContentSlider("slider1", 3000) //OR ContentSlider("slider1", 3000, linktextarray) //OR ContentSlider("slider1", 3000, linktextarray, "Foward") //OR ContentSlider("slider1", "", linktextarray) //OR ContentSlider("slider1", "", "", "Foward") </script> </body> </html> arquivo1.php Texto de texte numero 1 contentslider.js //** Featured Content Slider script- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com) //** Last updated: Feb 28th- 07- Added ability to customize pagination links' text ////Ajax related settings var csbustcachevar=0 //bust potential caching of external pages after initial Ajax request? (1=yes, 0=no) var csloadstatustext="<img src='loading.gif' /> Requesting content..." //HTML to indicate Ajax page is being fetched var csexternalfiles=[] //External .css or .js files to load to style the external content(s), if any. Separate multiple files with comma ie: ["cat.css", dog.js"] ////NO NEED TO EDIT BELOW//////////////////////// var enablepersist=true var slidernodes=new Object() //Object array to store references to each content slider's DIV containers (<div class="contentdiv">) var csloadedobjects="" //Variable to store file names of .js/.css files already loaded (if Ajax is used) function ContentSlider(sliderid, autorun, customPaginateText, customNextText){ var slider=document.getElementById(sliderid) if (typeof customPaginateText!="undefined" && customPaginateText!="") //Custom array of pagination links text defined? slider.paginateText=customPaginateText if (typeof customNextText!="undefined" && customNextText!="") //Custom HTML for "Next" link defined? slider.nextText=customNextText slidernodes[sliderid]=[] //Array to store references to this content slider's DIV containers (<div class="contentdiv">) ContentSlider.loadobjects(csexternalfiles) //Load external .js and .css files, if any var alldivs=slider.getElementsByTagName("div") for (var i=0; i<alldivs.length; i++){ if (alldivs.className=="contentdiv"){ slidernodes[sliderid].push(alldivs) //add this DIV reference to array if (typeof alldivs.getAttribute("rel")=="string") //If get this DIV's content via Ajax (rel attr contains path to external page) ContentSlider.ajaxpage(alldivs.getAttribute("rel"), alldivs) } } ContentSlider.buildpagination(sliderid) var loadfirstcontent=true if (enablepersist && getCookie(sliderid)!=""){ //if enablepersist is true and cookie contains corresponding value for slider var cookieval=getCookie(sliderid).split(":") //process cookie value ([sliderid, int_pagenumber (div content to jump to)] if (document.getElementById(cookieval[0])!=null && typeof slidernodes[sliderid][cookieval[1]]!="undefined"){ //check cookie value for validity ContentSlider.turnpage(cookieval[0], parseInt(cookieval[1])) //restore content slider's last shown DIV loadfirstcontent=false } } if (loadfirstcontent==true) //if enablepersist is false, or cookie value doesn't contain valid value for some reason (ie: user modified the structure of the HTML) ContentSlider.turnpage(sliderid, 0) //Display first DIV within slider if (typeof autorun=="number" && autorun>0) //if autorun parameter (int_miliseconds) is defined, fire auto run sequence window[sliderid+"timer"]=setTimeout(function(){ContentSlider.autoturnpage(sliderid, autorun)}, autorun) } ContentSlider.buildpagination=function(sliderid){ var slider=document.getElementById(sliderid) var paginatediv=document.getElementById("paginate-"+sliderid) //reference corresponding pagination DIV for slider var pcontent="" for (var i=0; i<slidernodes[sliderid].length; i++) //For each DIV within slider, generate a pagination link pcontent+='<a href="#" onClick=\"ContentSlider.turnpage(\''+sliderid+'\', '+i+'); return false\">'+(slider.paginateText? slider.paginateText : i+1)+'</a> ' pcontent+='<a href="#" style="font-weight: bold;" onClick=\"ContentSlider.turnpage(\''+sliderid+'\', parseInt(this.getAttribute(\'rel\'))); return false\">'+(slider.nextText || "Next")+'</a>' paginatediv.innerHTML=pcontent paginatediv.onclick=function(){ //cancel auto run sequence (if defined) when user clicks on pagination DIV if (typeof window[sliderid+"timer"]!="undefined") clearTimeout(window[sliderid+"timer"]) } } ContentSlider.turnpage=function(sliderid, thepage){ var paginatelinks=document.getElementById("paginate-"+sliderid).getElementsByTagName("a") //gather pagination links for (var i=0; i<slidernodes[sliderid].length; i++){ //For each DIV within slider paginatelinks.className="" //empty corresponding pagination link's class name slidernodes[sliderid].style.display="none" //hide DIV } paginatelinks[thepage].className="selected" //for selected DIV, set corresponding pagination link's class name slidernodes[sliderid][thepage].style.display="block" //show selected DIV //Set "Next" pagination link's (last link within pagination DIV) "rel" attribute to the next DIV number to show paginatelinks[paginatelinks.length-1].setAttribute("rel", thenextpage=(thepage<paginatelinks.length-2)? thepage+1 : 0) if (enablepersist) setCookie(sliderid, sliderid+":"+thepage) } ContentSlider.autoturnpage=function(sliderid, autorunperiod){ var paginatelinks=document.getElementById("paginate-"+sliderid).getElementsByTagName("a") //Get pagination links var nextpagenumber=parseInt(paginatelinks[paginatelinks.length-1].getAttribute("rel")) //Get page number of next DIV to show ContentSlider.turnpage(sliderid, nextpagenumber) //Show that DIV window[sliderid+"timer"]=setTimeout(function(){ContentSlider.autoturnpage(sliderid, autorunperiod)}, autorunperiod) } function getCookie(Name){ var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair if (document.cookie.match(re)) //if cookie found return document.cookie.match(re)[0].split("=")[1] //return its value return "" } function setCookie(name, value){ document.cookie = name+"="+value } ////////////////Ajax Related functions ////////////////////////////////// ContentSlider.ajaxpage=function(url, thediv){ var page_request = false var bustcacheparameter="" if (window.XMLHttpRequest) // if Mozilla, Safari etc page_request = new XMLHttpRequest() else if (window.ActiveXObject){ // if IE try { page_request = new ActiveXObject("Msxml2.XMLHTTP") } catch (e){ try{ page_request = new ActiveXObject("Microsoft.XMLHTTP") } catch (e){} } } else return false thediv.innerHTML=csloadstatustext page_request.onreadystatechange=function(){ ContentSlider.loadpage(page_request, thediv) } if (csbustcachevar) //if bust caching of external page bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime() page_request.open('GET', url+bustcacheparameter, true) page_request.send(null) } ContentSlider.loadpage=function(page_request, thediv){ if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) thediv.innerHTML=page_request.responseText } ContentSlider.loadobjects=function(externalfiles){ //function to load external .js and .css files. Parameter accepts a list of external files to load (array) for (var i=0; i<externalfiles.length; i++){ var file=externalfiles var fileref="" if (csloadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding if (file.indexOf(".js")!=-1){ //If object is a js file fileref=document.createElement('script') fileref.setAttribute("type","text/javascript"); fileref.setAttribute("src", file); } else if (file.indexOf(".css")!=-1){ //If object is a css file fileref=document.createElement("link") fileref.setAttribute("rel", "stylesheet"); fileref.setAttribute("type", "text/css"); fileref.setAttribute("href", file); } } if (fileref!=""){ document.getElementsByTagName("head").item(0).appendChild(fileref) csloadedobjects+=file+" " //Remember this object as being already added to page } } } contentslider.css .contentslide{ border: 10px solid navy; border-bottom-width: 6px; padding: 8px; width: 400px; height: 250px; } .contentslide .contentdiv{ display: none; } .pagination{ width: 416px; /*Width of pagination DIV. To equal that of Content Slider's width, take into account the later's left/right paddings!*/ text-align: right; background-color: navy; border: 10px solid navy; border-width: 0 10px; /*Left/ right border width of pagination DIV.*/ padding: 0 0 4px 0; } * html .pagination{ /*Simplified box model hack to get IE5 to display width equal to that of Content Slider's*/ width: 400px; /*IE5 width*/ w\idth: 416px; /*IE6 width*/ } .pagination a{ padding: 0 5px; text-decoration: none; color: #2e6ab1; background-color: white; } .pagination a:hover, .pagination a.selected{ color: #000; background-color: #FEE496; } Compartilhar este post Link para o post Compartilhar em outros sites
Osvaldo Pimenta 0 Denunciar post Postado Janeiro 25, 2008 Caro Amigo, eu baixei os que você postou aqui, apenas criei mais o arquivo2.php e arquivo3.php e funcionou perfeitamente. Talvez você esteja com algum problema em seu path. Eu deixei todos os arquivos no diretório raiz (estou utilizando apache2). Compartilhar este post Link para o post Compartilhar em outros sites
Marcio Leandro 0 Denunciar post Postado Janeiro 25, 2008 Imagino que seja o diretório contento espaços e acentos: C:/AppServ/www/DISPLAY DE NOTÍCIAS/ Compartilhar este post Link para o post Compartilhar em outros sites
Leandromx 0 Denunciar post Postado Janeiro 26, 2008 Creio que isso irá te ajudar http://www.dynamicdrive.com/dynamicindex17...ntentslider.htm Compartilhar este post Link para o post Compartilhar em outros sites
sedex 0 Denunciar post Postado Janeiro 29, 2008 Pessoal, já resolvi esse problema em partes! O slide já ta funcionando. Ele já busca os dados no bd e exibe perfeitamente.... mas exibi todos no mesmo slide. Mas o que eu gostaria agora era o seguinte..... E para cada slide, deve existir a div com a class contentdiv. Aqui eu seleciono as 5 ultimas noticias da tabela noticias. <?php $consulta_sqle = mysql_query("SELECT * FROM noticias ORDER BY data DESC LIMIT 0,5"); if($consulta_sqle){ while($row = mysql_fetch_array($consulta_sqle)){ $id = $row['id']; $diretorio = $row['diretorio']; $titulo = $row['titulo']; $secao = $row['secao']; $conteudo = $row['conteudo']; $imagem = $row['imagem']; if($imagem != 0){?> <div class="contentdiv"> <?php print('<div align="center"> <a href="exibe_noticias.php?noticia=' . $id . '"> <img class="images" src="imx_noticias.php?foto=noticias/'. $diretorio .'" alt="' . $titulo . '" style="border:0"> </a></div>'); ?> <?php print('<a class="linknoticias" href="exibe_noticias.php?noticia=' . $id . '">' . ($titulo) .'</a>'); ?><br> <?php print('<div class="texto_corpo">'.(nl2br(substr($conteudo, 0, 50) . '...')).'</div>'); ?> </div> <?php } else { ?> <div class="contentdiv"> <?php print('<a class="linknoticias" href="exibe_noticias.php?noticia=' . $id . '">' . ($titulo) . '</a>'); ?><br> <?php print('<a class="texto_corpo" href="exibe_noticias.php?noticia=' . $id . '">' . (nl2br(substr($conteudo, 0, 40) . '...')) . '</a>'); ?> </div> <?php } } } ?> Duvida Qual seria a lógica de exibir o último registro, depois o penúltimo, depois o anti-penúltimo, e assim por diante? Compartilhar este post Link para o post Compartilhar em outros sites
Leandromx 0 Denunciar post Postado Janeiro 29, 2008 Maninho resolvi, No meu pelo menos funcionou. A questão é a seguinte, não precisa fazer para mostrar o ultimo, penultimo etc.. Na sua SQL coloquei assim $consulta_sqle = mysql_query("SELECT * FROM noticias ORDER BY data DESC LIMIT 3"); // 3 são as 3 últimas HTML ficaria assim: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="contentslider.css" /> <script type="text/javascript" src="contentslider.js"> </script> </head> <body> <div id="slider1" class="contentslide"> <div class="opacitylayer"> // Inicio do loop aqui <div class="contentdiv"> Coloque aqui conteudo </div> // Fim do While aqui </div> </div> <div class="pagination" id="paginate-slider1"></div> <script type="text/javascript"> ContentSlider("slider1") </script> </body> Fazendo isso vai dar certo, pelo menos o meu deu Dá um grito no msn Compartilhar este post Link para o post Compartilhar em outros sites
sedex 0 Denunciar post Postado Janeiro 29, 2008 Não funcionou! O loop continua exibindo as três noticias no mesmo slide! acessa e ve a previa : http://www.forasteiros.com/rally Compartilhar este post Link para o post Compartilhar em outros sites
nknk 3 Denunciar post Postado Janeiro 29, 2008 Sedex, eu postei no laboratório um código em php para o sistema do tmferreira, pode ser q seja adequado para seu problema. Lá dá para colocar mais de uma notícia, muito fácil. Compartilhar este post Link para o post Compartilhar em outros sites
sedex 0 Denunciar post Postado Janeiro 29, 2008 Pessoal, com esse código que eu postei anteriormente, funcionou perfeitamente.... Mas por besteira, tentei colocar dentro de uma tabela, e o porque eu ainda não descobri... Mas se eu coloco tabelas, os registros aparecem sempre dentro do mesmo slide. Talvez deva ser algum problema no javascript. Mas agradeço por vocês terem tendado me ajudar! OBS.: Eu utilizei como base esse script aqui: Sllide Compartilhar este post Link para o post Compartilhar em outros sites