cocox92 Posted May 23, 2013 Report Posted May 23, 2013 Salut ,As avea nevoie de un script php care sa imi afiseze toate paginile dintr-un folder pe una singura.Mai pe scurt am un folder cu 1000+ pagini .html de forma, pagina_1.html , pagina_2.html etc. , imi este peste mana sa le deschid pe fiecare sa le citesc asa ca as dorii un script php , sa il pun in index.php si sa imi afiseze in josul paginii paginile respective 1,2,3,4,5,6 etc. , mi-ar fi mult mai usor dupa ce termin de citit o pagina sa pot schimba la alta direct din browser.Thanks Quote
Mecanik Posted May 23, 2013 Report Posted May 23, 2013 <?php $myDirectory = opendir("."); // Seteaza aici numele la folder.while($entryName = readdir($myDirectory)) { $dirArray[] = $entryName;}closedir($myDirectory);$indexCount = count($dirArray);Print ("$indexCount files<br>\n");sort($dirArray);print("<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n");print("<TR><TH>Filename</TH><th>Filetype</th><th>Filesize</th></TR>\n");for($index=0; $index < $indexCount; $index++) { if (substr("$dirArray[$index]", 0, 1) != "."){ print("<TR><TD><a href=\"$dirArray[$index]\">$dirArray[$index]</a></td>"); print("<td>"); print(filetype($dirArray[$index])); print("</td>"); print("<td>"); print(filesize($dirArray[$index])); print("</td>"); print("</TR>\n"); }}print("</TABLE>\n");?>Asta e gratis, daca vrei ceva mai avansat, adica cu numar de pagini etc, ma cauti si platesti.Daca nu, cheers! Quote
cocox92 Posted May 23, 2013 Author Report Posted May 23, 2013 Ceva de genul acesta http://s23.postimg.org/9lxdqezwr/cursuri.jpg , nu stiam cum sa explic exact asa ca am facut un desen. Quote
GarryOne Posted May 23, 2013 Report Posted May 23, 2013 (edited) <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script><SCRIPT type="text/javascript"> $(document).ready(function(){ $("#tabs a").click( function() { $("#current").load(this.href); return false ; } ) ; $("#tabs a:first").click() ; });</SCRIPT><style> #tabs p { text-align: center; background: silver; padding: 10px; } a {text-decoration: none; color: white;} a:hover {text-decoration: underline; }</style><div id="tabs"> <p> <?php $all_files = scandir(getcwd()); $i = 1; foreach($all_files as $val) { if(pathinfo($val, PATHINFO_EXTENSION) == 'html') { echo '<a href="'.$val.'"> '.$i++.' </a>'; } } ?> </p></div><div id="current"></div> Edited May 23, 2013 by GarryOne Quote
cocox92 Posted May 23, 2013 Author Report Posted May 23, 2013 Imi da urmatoarea eroare Parse error: syntax error, unexpected T_VARIABLE in /home/egazduir/public_html/index.php on line 25 Quote
GarryOne Posted May 23, 2013 Report Posted May 23, 2013 E vreo problema de la tine. La mine codul merge impecabil. Quote
cocox92 Posted May 23, 2013 Author Report Posted May 23, 2013 L-am incercat pe pc , am instalat xampp si pe un webhost platit , pe localhost primesc urmatoarea eroare"Parse error: syntax error, unexpected '$all_files' (T_VARIABLE) in C:\xampp\htdocs\index.php on line 25"si pe celalalt primesc eroarea aceasta"Parse error: syntax error, unexpected T_VARIABLE in /home/egazduir/public_html/index.php on line 25"Uite aici fisierele despre care e vorba http://egazduire.biz/dizertatie.rar Quote
GarryOne Posted May 23, 2013 Report Posted May 23, 2013 Am descarcat arhiva si merge bine. Nu stiu ce faci tu.Linia 24 si 25 e <?php$all_files = scandir(getcwd());Si e totul bine aici. Da-mi teamviewer atunci. Quote
GarryOne Posted May 23, 2013 Report Posted May 23, 2013 http://egazduire.biz/Doar am dat copy/paste la cod. Ti-e futut clipboard-ul sau ce plm? Quote
Silviu Posted May 23, 2013 Report Posted May 23, 2013 Functia scandir nu este suportata inca de PHP pe sistemul de operare Windows. Quote
GarryOne Posted May 23, 2013 Report Posted May 23, 2013 Functia scandir nu este suportata inca de PHP pe sistemul de operare Windows.Nu era de la asta problema. Oricum, cum poate ca php-ul sa nu accepte o functie? Poate ai vrut sa zici server-ul. Quote
cocox92 Posted May 23, 2013 Author Report Posted May 23, 2013 Ciudat , cu opera nu imi merge , am instalat google chrome si cu asta merge.O rugaminte mai am daca ma poti ajuta , imi arata cateva mii de pagini...cum as putea face sa am in felul urmator paginarea "Inapoi - 4 (nr paginii curente) - Inainte" cred ca intelegi ce vreau sa zicMultumesc mult pentru timpul acordat si scuze pentru deranj. Quote
Sim Master Posted May 23, 2013 Report Posted May 23, 2013 Functia scandir nu este suportata inca de PHP pe sistemul de operare Windows.De fapt merge f?r? probleme. Quote
cocox92 Posted May 23, 2013 Author Report Posted May 23, 2013 Stiti cumva cum fac sa imi apara corect fara acele semne de intrebare?Uitati o imagine http://s22.postimg.org/88bcmocw1/aaaaaaaaaaa.jpg Quote
cocox92 Posted May 23, 2013 Author Report Posted May 23, 2013 Acum am observat , nu sunt in ordine incepe de la 100 apoi trece la 1000 , numaratoarea paginilor mele incepe de la 72. Quote
cocox92 Posted May 23, 2013 Author Report Posted May 23, 2013 Daca bag in acea casuta de exemplu valoarea 9(numarul paginii) imi afiseaza tot prima pagina. Quote