HTML and CSS Reference
In-Depth Information
// Outputs the view
// Includes the header, requested view, and footer markup
require_once SYS_PATH . '/inc/';
require_once SYS_PATH . '/inc/';
// Function declarations
The header and footer markup—which you'll be creating a little later in this chapter—are simple includes,
and sandwiched between them is the call to the output_view() method of the controller object, which outputs the
formatted markup for the requested view.
Adding a URI Rewrite
The final step for getting the router running is to add the .htaccess file that will direct all requests through the router
(unless a file or subdirectory is directly requested).
In the root of your app, create a new file called .htaccess and insert the following code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
You may need to update the value of RewriteBase to match the path to your app. Some server setups will run
without the RewriteBase set, so if you get an error, try removing it first and then set it to your app's path.
if you're a Wordpress developer, you might recognize this code. this is the same set of rewrite rules used on
Wordpress sites.
Setting Up the Core Classes
Because every controller, view, and model used in the app will have baseline functionality, before you build any of
them you'll want to create abstract classes to house the common methods and declare any method and/or property
stubs that need to be included in all classes that extend them.
Search WWH ::

Custom Search