Site Sections
Sections
THIS uses "sections" as a way to categorize posts. Site sections are defined in
. For example:SECTIONS.INI
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 set outside of an INI section (not within []). Internally, that section becomes [root]
.
Note how the defined 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 site section is identified by the URL argument arg
— as in ?arg=about
, with no arg or ?arg=
being the default section.
Each "section" gets it's own database table, of the same name, created automatically at start-up. 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 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
file into the configuration array (see file CONFIG) as the setting SECTION.INI
sections
and is an associative array. For example:
var_dump(config('sections'));
array(2) { ["root"]=> 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).
Notes
1. We may change this file to actually use [root]
.
2. We are contemplating making this configurable and/or making use of URLs such as www.sitename.com/about
.
3. The file is parsed by the PHP function parse_ini_file()
.