3.3. Content of the layout.phtml file


The file layout.phtml contains the main HTML content with various PHP code and with certain PHP variables, which are output from Allmice CMS system. You can organize the HTML and PHP output content into many files including those other files into this main layout.phtml file.

The identifiers of the Allmice CMS output variables are quite self explanatory, but are explained a bit below too.

Most of the $GLOBALS* variables are some config values, which can be changed through Allmice CMS graphical user interface and are passed to here to the HTML code. The identifier for such $GLOBALS variables in square brackets is usually the same as uri value of the corresponding config entry. Some $GLOBALS* variables have other meaning, like $GLOBALS['baseUrl'] is meaning the main URL, where the website has been installed (which is also the URL of the frontpage).

Using $GLOBALS['baseUrl'] as replacement, whenever main absolute URL is needed, helps to use the same protocol for every link and image to avoid browser warnings if using HTTPS protocol, that some content is not using HTTPS protocol.

Below are listed most of the $GLOBALS* variables, which are used in the themes of Classic Edition:

The $Region* variables include the content of region areas. The identifiers in square brackets are the same as region codes, when adding or editing blocks. Region areas are like groups of blocks, locations of blocks. If you wish, that a block content will be displayed in a theme, then make sure, that this block is related to a region code, which contains corresponding Region variable in that theme.
For example: if a menu called naviMenu is wrapped with a block called naviMenu and this block is related to region code naviArea, then in a theme layout.phtml (or other included file), which can display such block, must be displayed the PHP variable $Region['naviArea'].

Not all region areas are displaying block content. Some module or general system functionality may put some content directly to a region area without any block. For example, you can not find regions title and siteName from List Blocks menu, but $Region['title'], $Region['siteName'] can be used in themes to output page title tag or site name content. The variable $Region['siteName'] can still be used, but Classic Edition has since version 1.5.7 a configuration entry with title template and core system decides according to this configuration whether to put site name into title region area or not.

Below are listed most of the $Region* variables, which were found from the ClassicBase theme:

The main content (which will be different, if URL is different) of every webpage is included in the variable $contentView. The rest of the mentioned system content output PHP variables are displaying content, which will be usually the same, when URL is different.

Previous: 3.2. The content of file config/Install/install-config.php | Next: 3.4. CSS selectors for custom themes
Manage themes
1. How to choose a different theme ?
2. How to use a custom theme ?
3. How to create your own custom themes?
3.1. Components and minimal requirements of a custom theme
3.2. The content of file config/Install/install-config.php
3.3. Content of the layout.phtml file
3.4. CSS selectors for custom themes
4. Conclusions about Allmice CMS themes