Changeset 2182
- Timestamp:
- 02/28/2008 10:34:02 AM (8 months ago)
- Location:
- trunk/system/libraries
- Files:
-
- 2 modified
-
Router.php (modified) (4 diffs)
-
URI.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/Router.php
r2171 r2182 21 21 public static $url_suffix = ''; 22 22 23 public static $directory = FALSE; 24 public static $controller = FALSE; 25 public static $method = FALSE; 26 public static $arguments = FALSE; 23 public static $directory = FALSE; 24 public static $controller = FALSE; 25 public static $controller_path = FALSE; 26 public static $method = FALSE; 27 public static $arguments = FALSE; 27 28 28 29 /** … … 142 143 // Path to be added to as we search deeper 143 144 $search = 'controllers'; 144 145 146 // controller path to be added to as we search deeper 147 $controller_path = ''; 148 145 149 // Use the rsegments to find the controller 146 150 foreach(self::$rsegments as $key => $segment) … … 152 156 { 153 157 self::$directory = $path.$search.'/'; 158 self::$controller_path = $controller_path; 154 159 self::$controller = $segment; 155 160 self::$method = isset(self::$rsegments[$key + 1]) ? self::$rsegments[$key + 1] : 'index'; … … 163 168 // Add the segment to the search 164 169 $search .= '/'.$segment; 170 $controller_path .= $segment.'/'; 165 171 } 166 172 } -
trunk/system/libraries/URI.php
r2074 r2182 237 237 return self::$rsegments[$end - 1]; 238 238 } 239 240 /** 241 * Returns the path to the current controller (not including the actual 242 * controller), as a web path 243 * 244 * @param bool If a full url should be returned, or only the path specifically 245 */ 246 public function controller_path($full = TRUE) { 247 if ($full) 248 { 249 return url::site(self::$controller_path); 250 } 251 return self::$controller_path; 252 } 253 254 /** 255 * Returns the current controller, as a web path 256 * 257 * @param bool If a full url should be returned, or only the controller specifically 258 */ 259 public function controller($full = TRUE) { 260 if ($full) 261 { 262 return url::site(self::$controller_path.self::$controller); 263 } 264 return self::$controller; 265 } 266 267 /** 268 * Returns the current method, as a web path 269 * 270 * @param bool If a full url should be returned, or only the method specifically 271 */ 272 public function method($full = TRUE) { 273 if ($full) 274 { 275 return url::site(self::$controller_path.self::$controller.'/'.self::$method); 276 } 277 return self::$method; 278 } 239 279 240 280 } // End URI Class
