Site Sections
Sections
THIS uses "sections" as a way to categorize posts — but this is optional as explained below. Site sections are defined in SECTIONS.INI
. For example:
name = Home subtitle = Main Page description = This website offers products and services
[products] name = Products subtitle = Buy our stuff description = These are the products that we offer allowcomments = 0
[services] name = Services subtitle = We do things description = These are the services that we offer allowcomments = 0
The default section is outside []
and must exist (but there is an alternative described below).
Note how the other sections have commenting turned off. A section can have it's own settings, including themedir
so that sections can have different themes. (Some configuration settings won't make sense in a section — a complete list is forthcoming.)
The name
and subtitle
values get used in the menu created by the default theme and in the <title> HTML tag. The description
value will be used for a <meta> description tag.
A section is identified in the URL as the first argument with a blank indicating the default section:
?about ?post=1 ?about&post=1
Each "section" gets it's own database table, of the same name, created automatically at start-up — the default section is internally named root
. There is also a related comments table created, by the name of {section}_comments
. (The comments table always gets created regardless of the allowcomments
configuration setting.)
There is an "import" directory for posts that (optionally) get read into the database upon first run of the program. There exists several posts in import/root
for example as you may have already seen.
Each section can have it's own "pages". Pages are like posts but are stored as files in the pages/{section}
directory. Pages are formatted identically to posts and they can be created, edited and deleted through Admin.
Configuration
During runtime configuration, the MOD/CONFIG.PHP
module reads the SECTION.INI
file into the configuration array (see file CONFIG) as the setting sections
and is an associative array. For example:
var_dump(config('sections'));
array(2) { [""]=> array(3) { ["name"]=> string(4) "Home" ["subtitle"]=> string(9) "Main Page" ["description"=> string(41) "This website offers products and services" } ["products"]=> array(4) { ["name"]=> string(8) "Products" ["subtitle"]=> string(13) "Buy our stuff" ["description"=> string(36) "These are the products that we offer" ["allowcomments"]=> string(1) "1" } }
Template Menus
The sections data are used to dynamically create the HTML template data for the main menu and the navigation (sidebar) menus (see file TEMPLATES, see file HTML).
Sections Need Not Be Used
If the SECTIONS.INI
file does not exist the default section is created from the SITE
section of CONFIG.INI
. The HTM/HTML.INI
and HTM/TEMPLATES.PHP
can then be changed (or a new theme created) to eliminate the "main menu" and the "navigation bar".
- The file is parsed by the PHP function
parse_ini_file()
.