tikkai maacos Posted September 21, 2006 Report Share Posted September 21, 2006 shits kods nolasa links.txt failus pa rindinjaam (no A liidz Z)... viss jau iet smuki bet vajag taa lai tas nolasiitu nevis A-Z bet Z-A <? $n = 1; $links = array(); $fp = fopen("links.txt", "r"); while (!feof($fp)) { $link = fgets($fp, 500); if($link) { $links[$n] = rtrim($link); $n++; } } fclose($fp); echo "<br> <font color=\"red\" size=\"+1\"> "; for ($i=1; $i<=sizeof($links); $i++) { if ($_GET['xxxx'] == $links[$i]) { echo "$links[$i]"; } else { echo "<a href=\"?xxxx=".$links[$i]."\">".$links[$i]."</a> "; } if ( $i<=(sizeof($links)-1)) { echo " <br>"; } } ?> shet vinjs to visu izvada.. <? $z=$_GET['xxxx']; include "$z.php"; ?> cik daudz kkas jaamina lai skripts lasiitu no apaksas? ja varat tad luudzu paliidat.. :) Link to comment Share on other sites More sharing options...
GedroX Posted September 21, 2006 Report Share Posted September 21, 2006 (edited) $fp = fopen("links.txt", "r"); while (!feof($fp)) { $link = fgets($fp, 500); if($link) { $links[$n] = rtrim($link); $n++; } } fclose($fp); vietā raksti $links = array_reverse(file("links.txt")); Un vēl, lai izmestu tukšās rindas, raksti foreach ($links as $k => $v) { $links[$k] = trim($links[$k]); if (!links[$k]) unset($links[$k]) } Edited September 21, 2006 by GedroX Link to comment Share on other sites More sharing options...
bubu Posted September 21, 2006 Report Share Posted September 21, 2006 Taisi tak ciklu otrādi: for ($i=sizeof($links); $i>=1; $i--) Link to comment Share on other sites More sharing options...
Recommended Posts