-
Notifications
You must be signed in to change notification settings - Fork 7
Engine parameters
When you initialize vodka you have to provide it with $params
array. This array itself consists of 5 subarrays:
system
templates
menu
pages
aliases
You can check demo config file to see how it works.
This associative array consists of various engine settings.
Base url of your site with trailing slash at the end, the only required parameter in system section.
Root directory of your site, can be absolute or relative. Defaults to realpath(dirname(__FILE__))
.
Controls error output, keep in mind that setting it to false will also suppress php errors and warnings. Defaults to false
.
Setting this to true
will redirect user if script name has been found in url. Defaults to true
.
Settings this to true
will clean the output of unused {VARS}
. Be careful with that as it replaces everything by pattern {[A-Z0-9:]+}
. Defaults to false
.
Name of the main page. The page must be defined in pages section. If there is no main page, vodka will load random page every time you load your base_url
.
Name of the "not found" page. The page must be defined in pages section. That page will be used as a 404 page (obviously).
Absolute or relative path. If defined, vodka will try to populate pages automatically from this directory.
This associative array defines templates and their location.
Relative to the site root
path to $template_name
. You can define as many templates as you want.
E.g. 'tpl1' => 'templates/tpl1'
.
This associative array defines site menu. This is completely optional, your site may not have a menu at all.
HTML code of the menu item. Variables that can be used here:
-
{VODKA:URL}
for page url -
{VODKA:NAME}
for page name -
{VODKA:TITLE}
for page title -
{VODKA:CLASS}
for menu-specific css class
E.g. "html" => '<li><a href="{VODKA:URL}" id="{VODKA:NAME}" class="{VODKA:CLASS}">{VODKA:TITLE}</a></li>'
.
Here you can specify a css class for current (selected) page. This will go directly to {VODKA:CLASS}
.
Same as selected_class
, but will be applied to the first and the last menu items, respectively.
This array defines site pages. It is required if auto_pages
param is disabled.
Each page element can have the following parameters.
Path to page, relative to the site root
. The only required page parameter.
Name of the page, which is used for menu generation ({VODKA:NAME}
). If omitted, it will be populated from page path
.
Title of the page, which is used for menu and page generation ({VODKA:TITLE}
). If omitted, it will be populated from page name
.
Meta description. Used to populate {VODKA:DESCRIPTION}
template variable.
Meta keywords. Used to populate {VODKA:KEYWORDS}
template variable.
An associative array with variables and values, used to replace something inside page. Example:
"custom" => [
"VAR1" => 'value1',
"VAR2" => 'value2'
]
Menu visibility flag. You can set it to false for special pages, such as "not found" page. Defaults to true
.
This flag will mark this page for AJAX loading (output will contain page content only). This feature is highly experimental and will likely change in the future.
This associative array ('alias_name' => 'page_name'
) defines aliases for pages. You can use it to create as many aliases as you want, but keep in mind that alises have a higher priority than page names.