andism88 Posted February 20, 2009 Report Share Posted February 20, 2009 (edited) Sveiki! tātad ir uztaisīts skripts : <?php if ($handle = opendir('faili')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo '<a href="index.php?p=faili&f='."$file\n".'">'."$file\n".'</a><BR>'; } } closedir($handle); } ?> Kuršs darbojā pilvērtīgi, bet vajag panākt lai vinjs izvada tikai faila nosaukumu bez paplasjinājumu (piemēram "fails.doc" vietā tikai "fails".. Kāds var palīdzēt.. Paldies :) Edited February 20, 2009 by andism88 Quote Link to comment Share on other sites More sharing options...
superKrona Posted February 20, 2009 Report Share Posted February 20, 2009 $file = substr($file, 0, -4); Quote Link to comment Share on other sites More sharing options...
andism88 Posted February 20, 2009 Author Report Share Posted February 20, 2009 $file = substr($file, 0, -4); Paldies šis strādā un pagaidām der :) Bet kā rīkoties ja faila paplašinājumam nebūs 3 burti bet vienam failam piemēram 2 vienam 3 un vēl kādam četri (pagaidā varu iztikt ar šo, bet jamācās n;akotei :) ) Quote Link to comment Share on other sites More sharing options...
x000x01 Posted February 20, 2009 Report Share Posted February 20, 2009 (edited) $search = '(\.)(.*)'; $replace = '\\1'; $file = ereg_replace( $search, $replace, $file ); Edited February 20, 2009 by x000x01 Quote Link to comment Share on other sites More sharing options...
marcis Posted February 20, 2009 Report Share Posted February 20, 2009 pathinfo() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.