Platform PT - Handler_Request
- Location: /lib/handler/requesthandler.lib.php
This class is a static one, singleton design pattern. It is automatically instantiated by the framework.
URI filleting
On startup it analyses the current $_SERVER['REQUEST_URI'], extracts the interesting parts and stores them in an array. It only uses the path part of the URL.
Example: http://www.example.net/organizer/2007/07/04
This should encourage you not to use too much vars on the URI and to format them consistently. It also produces nice URLs, the kind that search engines prefer.
Accessing
Use
$arrRequest = PRequest::get()->request;
to get an array with the sliced information back. The example above would yield
Array(
[0] => organizer
[1] => 2007
[2] => 07
[3] => 04
)
Constraints
Per definition and common sense the first [0] array member denotes the application basename! Its controller class' (e.g. organizerController) index() method is called automatically at startup. Every other value may be chosen freely.
But, keep the rewrite_rule in mind! If a file or directory physically exists, the framework is not called!
Another constraint (and again common sense) is that you can only use normal URL characters, for RegEx-people its
/[a-z0-9\.\-_, ]+$/i
Every other character (like ü,ö,á,ê...) will lead to exclusion of that part of the URI. (BTW, it might be that you'll fail much earlier because apache mod_rewrite doesnt like those characters, too.)
