Welcome to the CI4MS Theme Development Guide. This documentation will walk you through the process of building a custom theme for the CMS/ERP hybrid system.
A standardized CI4MS theme (e.g., starter) spans across app/ and public/ directories:
app/Config/templates/starter/ThemeConfig.php and Routes.php. Used for defining custom frontend routes or CSRF exclusions for theme-specific API/POST requests.
app/Controllers/templates/starter/Forms.php). Use this to handle theme-specific POST logic such as Contact Forms, Surveys, or Auth customizations.
app/Helpers/templates/starter/funcs_helper.php. You can define custom helper methods (e.g., get_custom_widget()) available directly within your views.
app/Libraries/templates/starter/Ci4mstemplateLib.php. Extended from the core template manager, use this class to create View Cells or theme-specific data injection logic.
app/Views/templates/starter/base.php, pages.php, blog/list.php, etc.
public/templates/starter/info.xml that registers your theme in the administrative panel.
Before activating your theme, ensure info.xml is present in your public/templates/{themeSlug}/ folder.
<?xml version="1.0" encoding="UTF-8" ?>
<theme>
<name>Starter Theme</name>
<slug>starter</slug> <!-- Must match your folder names logically -->
<author>Your Identity</author>
<screenshotPNG>starter/screenshot.png</screenshotPNG>
<version>1.0.0</version>
<description>Your theme specification</description>
</theme>
The core structural file is app/Views/templates/{themeSlug}/base.php. It serves as the master HTML layout.
CRITICAL: The module renderer will automatically parse and output the main response to a variable named $content. You must echo $content inside the body element.
Example snippet:
<main>
<?= $content ?? '' ?>
</main>
$seo: Pre-constructed HTML string containing the title, description, keywords generated by ci4seopro.$meta: Additional system-level meta tags or language alternatives.$content: Executed HTML output derived from specific Module Controllers (Pages, Blog, etc).
If you define custom routes in app/Config/templates/starter/Routes.php, they will take precedence matching before the catch-all dynamic URL handlers in CI4MS. Thus, any post logic (/form-submit) should be registered here instead of core routes.
Download our fully structured Starter Theme Package or explore the architecture further.