← Back to team overview

anewt-developers team mailing list archive

[Branch ~uws/anewt/anewt.uws] Rev 1735: [urldispatcher] More docs

 

------------------------------------------------------------
revno: 1735
committer: Wouter Bolsterlee <uws@xxxxxxxxx>
branch nick: anewt.uws
timestamp: Sun 2009-08-02 22:54:23 +0200
message:
  [urldispatcher] More docs
modified:
  urldispatcher/urldispatcher.lib.php


--
lp:anewt
https://code.launchpad.net/~uws/anewt/anewt.uws

Your team Anewt developers is subscribed to branch lp:anewt.
To unsubscribe from this branch go to https://code.launchpad.net/~uws/anewt/anewt.uws/+edit-subscription.
=== modified file 'urldispatcher/urldispatcher.lib.php'
--- urldispatcher/urldispatcher.lib.php	2009-08-02 20:09:24 +0000
+++ urldispatcher/urldispatcher.lib.php	2009-08-02 20:54:23 +0000
@@ -58,7 +58,7 @@
  * Well-designed web applications use a clean URL scheme for all pages and
  * resources in the application. Read ‘<a
  * href="http://www.w3.org/Provider/Style/URI";>Cool URIs don't change</a>’ to
- * find out why this is important. Clean web applicatiosn do not need ugly
+ * find out why this is important. Clean web applications do not need ugly
  * <code>.php</code> extensions or weird HTTP GET parameters with cryptic
  * numbers or strange identifers. Instead, you are encouraged to use clean URLs,
  * e.g. <code>/user/USERNAME</code> for a user page.
@@ -85,7 +85,7 @@
  * file, e.g. a user page, an ‘edit user’ page, or a ‘new user’ page. (Note that
  * if you insist you can still <code>require_once('latest-news.php')</code> in
  * your command method, though this is not how AnewtURLDispatcher is intended to
- * be used.
+ * be used).
  *
  * \section routes Routes
  *
@@ -94,14 +94,6 @@
  * processes an incoming request. The section on routes below explains how
  * routes work in more detail.
  *
- * In addition to explicit routes that map URLs to commands, you can also add
- * a default command that will be invoked if none of the routes match. The
- * default command will be called if none of the provided URL routes (both
- * explicit and implicit) match the request URL. This method can be used to
- * supply default functionality. Note that this is not the right way to handle
- * errors; use handle_error_not_found() or one of the other error callbacks
- * instead.
- *
  *
  * \section getting-started Getting Started
  *
@@ -233,21 +225,37 @@
 	 * \name Route Methods
 	 *
 	 * <strong>Routes</strong> define how URLs map to commands. Whenever a route
-	 * matches the request, the corresponding command is called to handle the
-	 * request. Two types of routes can be used (read on for an explanation on
+	 * matches the request, the corresponding command is invoked to handle the
+	 * request. Command methods get passed a \c $parameters argument containing
+	 * values for parameters that were defined when setting up the route (either
+	 * regular expression matches, or named parameters, depending on the type of
+	 * URL route).
+	 *
+	 * Incoming requests will be matched against all defined routes, until
+	 * a route matches the current request, in which case the associated command
+	 * is invoked. The routes are tried in the order in which they are added to
+	 * the dispatcher. Therefore you should add more specific routes before more
+	 * general routes.
+	 *
+	 * If you decide to use automatic commands, those will be tried if none of
+	 * the explicitly defined routes matched the request. See the
+	 * <code>automatic-commands</code> property description for more details on
+	 * this feature.
+	 *
+	 * In addition to explicitly created routes, you can also add
+	 * a <strong>default command</strong> that will be invoked if none of the
+	 * routes match. The default command will be invoked if none of the provided
+	 * URL routes (both explicit routes and automatic commands, if enabled)
+	 * match the request URL. This method can be used to supply default
+	 * functionality. Note that this is not the right way to handle errors; use
+	 * handle_error_not_found() or one of the other error callbacks instead.
+	 *
+	 * Two types of routes can be used (read on for an explanation on
 	 * both):
 	 *
 	 *   -# using regular expressions
 	 *   -# using URL parts
 	 *
-	 * Incoming requests will be matched against all defined routes, until
-	 * a route matches the current request. The routes are tried in the order
-	 * they are added to the dispatcher. Therefore you should add more specific
-	 * routes before more general routes. If a route matches, the corresponding
-	 * command is invoked with the \c $parameters argument containing all
-	 * matches parameters (either regular expression matches, or named
-	 * parameters, depending on the type of URL route).
-	 *
 	 * <strong>Regular expression routes</strong> use a regular expression to
 	 * match an URL, and can be added using
 	 * AnewtURLDispatcher::add_route_regex(). The URL that is used for matching