Routing
SQL
By default, 8 SQL tables are created during the installation process:
- pages_bck
- pages_frt
- pages_lang_bck
- pages_lang_frt
- settings_bck
- settings_frt
- users_bck
- users_frt
All tables are prefixed with the chosen DB_PREFIX.
Informations for displaying home page are located in settings_(frt_bck), informations for specific pages are located in pages_(frt_bck), i18n informations in pages_lang_(frt_bck), and users informations in users_(frt_bck).
URL routing is automatically setted in ../core/(front_end/back_end)/actions/_init/themes.init.php
Three routing constants are defined and can also be used in the action files:
THEME_LANG_FRT/BCK // language defined for the involved page
THEME_FOLDER_FRT/BCK // theme defined for the involved page
TPL_FRT/BCK // TPL defined for the involved page
page_id
By default, a page is displayed by the GET_PAGE_ID ($_GET['page_id']) matched with the corresponding page_id_(frt/bck) in pages_(frt/bck).
<!-- Example -->
<a href="?page_id=1"> <!-- displays page whose page_id_(frt/bck) = 1 in DB -->
New pages can easily be created with the back-end panel. If GET_PAGE_ID does not exist in page_id_(frt/bck), a 404 error message will be displayed.
page_lang
A home page can also be displayed in different languages with GET_PAGE_LANG ($_GET['page_lang']):
<!-- Example -->
<a href="?page_lang=fr-fr"> <!-- displays French home page -->
If GET_PAGE_LANG does not exist as home page, a 404 error message will be displayed.
If another language that default language has been chosen via GET_PAGE_LANG, it will be stored in SESSION_PAGE_LANG and will become the new default language until another language is chosen.
A page can also be matched to another one with the same content but in another language (e.g. for purpose of translation); to do this, you need first to associate your referral page_id (e.g. '1' for 'en-us') with the corresponding page_id for the chosen language (e.g. '2' for 'fr-fr') in pages_lang_(frt/bck).
Then, create a HTML link which associate the language chosen with referral page_id:
<!-- Example -->
<a href="?page_lang=fr-fr&page_id=1">
<!-- will redirect user on the equivalent of page_id=1 for French language i.e. page_id=2 -->
Permissions
Access can be controlled with the constant AUTH_ACCESS_FRT/BCK in the actions files.
//-----------------------------------------------------
// restricted access
//-----------------------------------------------------
if (defined("AUTH_ACCESS_FRT/BCK") && (AUTH_ACCESS_FRT/BCK == x)) {
...
//-----------------------------------------------------
// public access
//-----------------------------------------------------
} else {
...
}
Replace 'x' by the user access level defined in users_frt/bck with user_level_access_frt/bck. User access level must be different from 0.