-
Notifications
You must be signed in to change notification settings - Fork 1
Basic concepts # Routing
Content management systems like WebsiteBaker or LEPTON CMS are using static addresses. If you are opening the URL
http://www.<domain.tld>/page/hello-world.php
you will see the content of the page Hello world. To make this work, the file /page/hello-world.php must really exists (the CMS take care of the file handling).
The kitFramework is using a dynamic routing as described in the Silex documentation.
The kitFramework is placed in the /kit2 directory below the root of your CMS:
http://www.<domain.tld>/kit2
if you are opening this address in your browser, you will be redirected to the login dialog of the kitFramework, or - if you are already logged in - to the welcome dialog:
http://www.<domain.tld>/kit2/admin/welcome
If your are checking your webspace with a FTP browser, you will see that the /kit2 directory exists and some other directories below, but you will not find a /kit2/admin directory. It does not exists.
Each access to any URL below the root of the kitFramework:
http://www.<domain.tld>/kit2
will be caught and checked before executing.
/admin/welcome
is a route.
You can define any route you want in the bootstrap.include.php of your extension for the kitFramework. The route will execute an controller, which return the result you want.
In addition routes can also
- contain variables (dynamic routing)
- start with
/adminto grant that the user must be authenticated - start with
/commandto handle the route as kitCommand
Routes are a very powerful and flexible solution to create dynamic content.
To make routes working a Web Server is needed, which allows the rewriting of URLs.
A .htaccess file in the /kit2 directory defines the rules for the rewriting. Instead of rising a 404 error if a file not exists, the server redirect the access with all parameters to the specified address.
In the case of the kitFramework this is /kit2/bootstrap.php. The bootstrap initializes the kitFramework, extracts the route from the URL and executes the assigned controller. It's very easy to handle.
- If you spot a typo or want to contribute an article, a how-to or a tip, please feel free to edit the Wiki directly
- If you you have any question or suggestion, please contact the phpManufaktur Support Group
This Documentation is part of the KIT2 Project
© 2013 by phpManufaktur, kitFramework is published under MIT license.
- Silex Documentation
- Silex API
- Twig Template Engine
- Twig Short Reference
- Symfony Form Factory
- Doctrine DBAL
- Swift Mailer
- Requirements
- Installation
- .htaccess
- Configuration
- Constants
- Utilities
- Twig Extensions
- kitFramework API