note 57993 added to function.ucwords

From: Date: Thu, 20 Oct 2005 23:14:40 +0000
Subject: note 57993 added to function.ucwords
Groups: php.notes 
Request: Send a blank email to php-notes+get-97329@lists.php.net to get a copy of this message
Here's a piece that allows you to use the contents of a directory.. capitalizes the words and make links.. this particular example splits file names at _ and only selects file with .htm extensions (thought you could use any extension and call it using include() or soom such) ie my_file_name.htm will produce <a href="my_file_name.htm">My File Name</a> <?php $path = "/home/path/to/your/directory"; $mydir = dir($path); while(($file = $mydir->read()) !== false) { if(substr($file, -4)=='.htm'){ $trans = array("_" => " ", ".htm" => ""); // creates the editing array $newlist = strtr($file, $trans); // edits using editing array echo "<a href=\"".$file."\">".ucwords($newlist)."</a><br>"; } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.ucwords.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57993 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57993&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57993&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57993&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57993&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57993&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57993&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57993&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57993&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97329) next »