From f5fb16ae5799cc89cf9252e453099cfe13b93a67 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Tue, 16 Jun 2015 12:08:45 +0000 Subject: [PATCH] route : allow prerouting informations to be added in map comparisons git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2205 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- route.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/route.php b/route.php index 322ba66..9c165a5 100644 --- a/route.php +++ b/route.php @@ -26,6 +26,8 @@ class route // Provide the the class catch errors in routing. // Must be provided in an array(class,method); public $errors = null; + /** Preroute used in modules */ + public $preroute = ""; /** Return the baseURL of the site Always finish with a slash @@ -263,6 +265,7 @@ class route @param function $function Function to be executed if the route match */ public function get ($route, $function) { + $route = $this->preroute.$route; if ($this->debug) echo "
==> GET $route ?? ";
     if ($this->method () !== "GET")
@@ -284,6 +287,7 @@ class route
       @param function $function Function to be executed if the route match */
   public function post ($route, $function)
   {
+    $route = $this->preroute.$route;
     if ($this->debug)
       echo "
==> POST $route ?? ";
     if ($this->method () !== "POST")
@@ -305,6 +309,7 @@ class route
       @param function $function Function to be executed if the route match */
   public function put ($route, $function)
   {
+    $route = $this->preroute.$route;
     if ($this->debug)
       echo "
==> PUT $route ?? ";
     if ($this->method () !== "PUT")
@@ -326,6 +331,7 @@ class route
       @param function $function Function to be executed if the route match */
   public function delete ($route, $function)
   {
+    $route = $this->preroute.$route;
     if ($this->debug)
       echo "
==> DELETE $route ?? ";
     if ($this->method () !== "DELETE")