Skip to content
deseven edited this page Dec 16, 2019 · 10 revisions

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.

system

This associative array consists of various engine settings.

[string] base_url

Base url of your site with trailing slash at the end, the only required parameter in system section.

[string] root

Root directory of your site, can be absolute or relative. Defaults to realpath(dirname(__FILE__)).

[bool] show_errors

Controls error output, keep in mind that setting it to false will also suppress php errors and warnings. Defaults to false.

[bool] forbid_scriptname

Setting this to true will redirect user if script name has been found in url. Defaults to true.

[bool] clean_unused_vars

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.

[string] main_page

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.

[string] 404_page

Name of the "not found" page. The page must be defined in pages section. That page will be used as a 404 page (obviously).

[string] auto_pages

Absolute or relative path. If defined, vodka will try to populate pages automatically from this directory.

templates

This associative array defines templates and their location.

[string] $template_name

Relative to the site root path to $template_name. You can define as many templates as you want.
E.g. 'tpl1' => 'templates/tpl1'.

menu

This associative array defines site menu. This is completely optional, your site may not have a menu at all.

[string] html

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>'.

[string] selected_class

Here you can specify a css class for current (selected) page. This will go directly to {VODKA:CLASS}.

[string] selected_class_first [string] selected_class_last

Same as selected_class, but will be applied to the first and the last menu items, respectively.

pages

This array defines site pages. It is required if auto_pages param is disabled.
Each page element can have the following parameters.

[string] path

Path to page, relative to the site root. The only required page parameter.

[string] name

Name of the page, which is used for menu generation ({VODKA:NAME}). If omitted, it will be populated from page path.

[string] title

Title of the page, which is used for menu and page generation ({VODKA:TITLE}). If omitted, it will be populated from page name.

[string] description

Meta description. Used to populate {VODKA:DESCRIPTION} template variable.

[string] keywords

Meta keywords. Used to populate {VODKA:KEYWORDS} template variable.

[array] custom

An associative array with variables and values, used to replace something inside page. Example:

"custom" => [
	"VAR1"  => 'value1',
	"VAR2"  => 'value2'
]

[bool] visible

Menu visibility flag. You can set it to false for special pages, such as "not found" page. Defaults to true.

[bool] isAJAX

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.

aliases

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.

Clone this wiki locally