Permalink
Browse files

explained it a bit more. renamed framework to 'piece of code'

  • Loading branch information...
1 parent f828656 commit cf9c1943b8b1094d3cd00a94fa3037bbfb2def88 @pkrumins committed Feb 22, 2010
Showing with 28 additions and 6 deletions.
  1. +2 −2 index.php
  2. +26 −4 readme.txt
View
@@ -3,7 +3,7 @@
** Peteris Krumins
** peteris.krumins@gmail.com
**
-** A routing framework written in 2000.
+** A simple URL routing code, written in 2000.
*/
error_reporting(E_ALL);
@@ -18,7 +18,7 @@
$parts = parse_url($_SERVER['REQUEST_URI']);
$path = preg_replace('#^/+#', '', $parts['path']); // drop slashes from the beginning of the request path
-$path = preg_replace('#(//)+#', '', $path); // drop duplicate slashes
+$path = preg_replace('#(//)+#', '', $path); // drop duplicate slashes
$path = preg_replace('#/+$#', '', $path); // drop trailing slashes
$path = split('/', $path);
View
@@ -1,6 +1,7 @@
-PHP2000, written in 2000, is a simple URL routing framework. It does not
-require anything newer than PHP4 and uses require() calls to route requests to
-the appropriate handlers.
+PHP2000, written in 2000, is a simple URL routing framework (if you may call a
+20 line program so). It does not require anything newer than PHP4 and uses
+require() calls to route requests to the appropriate handlers. The handlers
+are simply PHP files.
This framework was written by Peteris Krumins (peter@catonmat.net) in 2000.
His blog is at http://www.catonmat.net -- good coders code, great reuse.
@@ -10,5 +11,26 @@ His blog is at http://www.catonmat.net -- good coders code, great reuse.
It uses website.conf INI file to store the possible request pages in the
[pages] section.
-To use it, rewrite all requests to index.php.
+For example, if the [pages] section looks like this:
+
+ [pages]
+ default = page-index.php
+ error = page-error.php
+ about = page-about.php
+ users = page-users.php
+
+Then requesting http://yoursite.com/about/ will require('page-about.php'),
+similarly, requesting http://yoursite.com/users/ will
+require('page-users.php').
+
+The 'default' handler refers to a request to http://yoursite.com/.
+The 'error' handler gets require()d when no url matches.
+
+To use it, rewrite all the requests to index.php.
+
+------------------------------------------------------------------------------
+
+Sincerely,
+Peteris Krumins
+http://www.catonmat.net

0 comments on commit cf9c194

Please sign in to comment.