Site Sections
Sections
THIS uses "sections" as a way to categorize posts. Site sections are defined in
. For example:SECTIONS.INI
name = Home title = Main Page
[products] name = Products title = Buy our stuff! allowcomments = 0
[services] name = Services title = We do things! allowcomments = 0
The default section is set outside of an INI section (not within []).
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.)
Internally, the default section is named root
. 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 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) { [""]=> array(2) { ["name"]=> string(5) "Index" ["subtitle"]=> string(16) "The THIS Project" } ["about"]=> array(3) { ["name"]=> string(5) "About" ["subtitle"]=> string(18) "About THIS Project" ["allowcomments"]=> string(1) "1" } }
The odd thing is that the default section is identified by "" (which PHP is happy to do). When the default section is actually used by the code (in the database for example) the name is changed to root
— we know that that is not very cool and are planning on fixing it.
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 are contemplating making this configurable and/or making use of URLs such as www.sitename.com/about
.
2. The file is parsed by the PHP function parse_ini_file()
.