Introduction
Basic Concepts
Understanding Routing
Controllers
Views
Assets
Modules Calling Modules
Parent & Child Modules
Database Operations
Modules within Modules
Templates & Themes
Helpers Explained
Form Handling
Working with Files
The Module Import Wizard
Authorization & Authentication
The API Explorer
If you’ve found an error, spotted something missing, or feel a section could be clearer or better explained, we’d love to hear from you. Your feedback helps keep the documentation accurate and useful for everyone.
Please report issues or suggest improvements on GitHub. Community input is invaluable in making the docs stronger.
Not comfortable with GitHub? No problem — you can also get in touch with us directly via our contact form. We welcome all feedback.
Creating Custom Themes
Trongate's theming system allows you to create comprehensive design packages that include templates, stylesheets, JavaScript files, and other assets. This guide will walk you through the process of creating your own custom theme.
Theme Location
Themes in Trongate are stored in the public/themes
directory of your application. Each theme gets its own subdirectory where all its resources are contained.
Creating a Custom Theme
Step 1: Plan Your Theme Structure
Before creating your theme, plan its structure and organization. Consider what elements your theme needs:
- Template files (
.php
) - Stylesheets (
.css
) - JavaScript files (
.js
) - Images and icons
- Other assets (if needed)
Step 2: Create the Theme Directory
Create a new directory in public/themes
for your theme. Choose a descriptive name that reflects its purpose. For example:
Step 3: Create the Template File
Create your main template file (e.g., dashboard.php
) in your theme directory:
Step 4: Register Your Theme
Open config/themes.php
and add your theme configuration:
Key Theme Components
Your theme should include:
- A well-organized directory structure for assets
- The
base
tag withBASE_URL
for proper path resolution - Proper use of
THEME_DIR
for asset references - The
Template::display($data)
call for content injection - Support for additional includes (
$additional_includes_top
and$additional_includes_btm
)
When creating shared assets, consider placing them in a common directory at the theme root level. This allows multiple variations of your theme to access the same base resources while maintaining their unique styles.
Using Your Theme
To use your new theme from any controller, specify it when calling the template method:
Creating Theme Variations
To create variations of your theme (e.g., different color schemes):
- Create a new directory within your theme folder for each variation
- Include variation-specific assets (CSS, images, etc.)
- Register each variation in
themes.php
- Keep shared assets in a common location
Always use unique, descriptive names for your themes to avoid conflicts with existing themes in the application or third-party theme packages.
By properly structuring your theme and its variations, you create a maintainable and portable design package that can be easily shared across projects or with the community.