Theme Class
Presentation & Theme Architecture Class
The Theme class is the primary orchestrator for the visual presentation layer of GeniXCMS. It manages the discovery, activation, and rendering of themes, providing standardized methods for including structural components (Headers, Footers, Sidebars) and handling theme-specific logic through function.php and options.php integrations.
⚡ Structural Rendering Methods
GeniXCMS themes follow a modular architecture. These methods allow you to bridge your PHP logic with your presentation templates.
Theme::header($data) / Theme::footer($data)
These are the foundational entry/exit points for every theme file.
header(): Sends SEO meta-tags and cache headers, then includes the theme'sheader.php.footer(): Includesfooter.phpand executes thefooter_load_libhook for library injection.- Data Flow: The
$dataarray passed to these methods is globally accessible within the theme files.
Theme::theme(string $file, ...)
A secure loader for including sub-templates from the active theme directory.
// Includes: inc/themes/{active_theme}/sidebars/main-blog.php
Theme::theme('sidebars/main-blog');
🛠️ Theme Infrastructure & Logic
The Theme class facilitates the separation of design and business logic through specialized entry points.
| File | Role | Automated Loading |
|---|---|---|
function.php |
Custom helper functions and hooks. | Loaded automatically during System boot. |
options.php |
The theme's administration settings panel. | Included via the Admin > Appearance menu. |
themeinfo.php |
Metadata (Name, Version, Author). | Parsed by Theme::data() for the dashboard. |
🏗️ Administrative Management
These methods are primarily used by the core dashboard to manage the theme lifecycle.
Theme::activate(string $name): Sets the specified folder as the system's active theme.Theme::thmList(): Scans theinc/themes/directory for valid theme packages.Theme::data(string $name): Extracts versioning and credit information from a theme's metadata file.
🎨 Creative Tools & Utilities
Theme::editor(string $mode, ...)
Configures and injects the Summernote WYSIWYG editor for use within theme-driven forms or module interfaces.
- Modes:
mini,light, orfulltoolsets.
// Render a compact editor in your theme's frontend form
Theme::editor('mini', 200);
📂 Internal Constants
Upon initialization, the class defines the THEME constant, which contains the folder name of the currently active theme. This is used system-wide for absolute path resolution.
Theme::theme() instead of standard PHP include. This method uses an internal registry to prevent redundant disk I/O when including the same component multiple times.Url::theme() to retrieve the public-facing URL of your theme's assets (CSS, JS, Images).See Also
- Url Class — Retrieving absolute paths for theme assets.
- OptionsBuilder Class — Building professional settings panels within
options.php. - Theme User Guide — Managing appearance from the dashboard.