GeniXCMS

Theme Class

categoryAPI edit_calendar31 Mar 2026

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's header.php.
  • footer(): Includes footer.php and executes the footer_load_lib hook for library injection.
  • Data Flow: The $data array 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 the inc/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, or full toolsets.
// 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.


lightbulb
TipPerformance Hint: To ensure your theme remains high-performing, always use 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.

priority_high
ImportantTheme Security: Never hardcode your theme's path. Always use the Url Class: Url::theme() to retrieve the public-facing URL of your theme's assets (CSS, JS, Images).

See Also