Custom Themes
SLAED CMS uses a flexible template system that allows you to completely change the look of your site without modifying the core system code. This guide covers creating custom themes for your SLAED CMS installation.
Table of Contents
Theme Structure
Each theme is located in a separate folder in the templates/
directory:
templates/
├── default/ # Default theme
│ ├── index.html # Main page template
│ ├── basic.html # Basic content template
│ ├── title.html # Title template
│ ├── pagenum.html # Pagination template
│ ├── block-*.html # Block templates
│ ├── *.html # Specialized templates
│ ├── theme.css # Theme CSS
│ ├── system.css # System styles
│ ├── blocks.css # Block styles
│ └── images/ # Theme images
└── custom_theme/ # Custom theme
├── index.html
└── ... # Other theme files
Main Templates
The main template defines the overall page structure:
<!DOCTYPE html>
<html lang="{%lang%}">
<head>
<meta charset="UTF-8">
<title>{%title%}</title>
<link rel="stylesheet" href="templates/{%theme%}/theme.css">
</head>
<body>
<header>
<h1>{%sitename%}</h1>
<p>{%slogan%}</p>
</header>
<nav>
<!-- Navigation -->
</nav>
<main>
{%content%}
</main>
<aside>
{%blocks%}
</aside>
<footer>
<p>© 2026 {%sitename%}</p>
</footer>
</body>
</html>
Template Placeholders
{%lang%}
- Site language (ru, en, de, etc.){%title%}
- Page title{%sitename%}
- Site name{%slogan%}
- Site slogan{%content%}
- Main page content{%blocks%}
- Site blocks{%theme%}
- Current theme name
Block System
Block types:
- l - Left column
- r - Right column
- c - Center area
- d - Bottom of page
- s - Floating blocks
- o - Floating blocks (alternative)
Block Templates
For each block, the system looks for a specific template with the following priority:
block-{block_id}.html
- Individual block templateblock-{module}.html
- Module-specific templateblock-{position}.html
- Position-specific template (left, right, center, down)block-all.html
- General template for all blocks
Example block template:
<div class="block block-{%position%}">
<h3>{%title%}</h3>
<div class="block-content">
{%content%}
</div>
</div>
Template API
Key template functions:
// Basic template function
function setTemplateBasic($tpl, $values = '') {
global $theme, $conf;
// Implementation
}
// Block template function
function setTemplateBlock($tpl, $values = '') {
// Implementation
}
// Warning template function
function setTemplateWarning($tpl, $settings) {
// Implementation
}
Creating Custom Themes
To create a custom theme:
- Create a new folder in
templates/
with your theme name - Create the main template files
- Add CSS styles
- Customize HTML structure
Preparing Structure
mkdir templates/my_theme
Essential Theme Files
Minimum set of files for a new theme:
index.html
- Main templatebasic.html
- Basic content templateblock-all.html
- Default block templatetheme.css
- Theme styles
Adapting Existing Theme
To create a theme based on an existing one:
cp -r templates/default templates/my_theme
CSS Optimization
SLAED CMS supports CSS optimization:
- CSS compression
- File merging
- Minification
- Browser caching
System Styles
SLAED CMS provides base CSS classes for quick styling:
.sl_block
- Base block class.sl_content
- Content area.sl_form
- Forms.sl_button
- Buttons.sl_table
- Tables
Custom Styles
To add custom styles:
- Create
theme.css
in your theme folder - Include it in
index.html
:
<link rel="stylesheet" href="templates/{%theme%}/theme.css">
Advanced Features
Conditional Templates
Templates can contain conditional constructs:
<!-- IF {%user_logged%} -->
<div class="user-panel">
Welcome, {%username%}!
</div>
<!-- ELSE -->
<div class="login-form">
<a href="/login">Login</a>
</div>
<!-- ENDIF -->
Loops in Templates
For displaying lists of elements:
<!-- BEGIN item -->
<div class="item">
<h4>{%item.title%}</h4>
<p>{%item.description%}</p>
</div>
<!-- END item -->
Responsive Design
For creating responsive themes, use:
/* Mobile devices */
@media (max-width: 768px) {
.container {
width: 100%;
padding: 10px;
}
}
/* Tablets */
@media (min-width: 769px) and (max-width: 1024px) {
.container {
width: 90%;
}
}
/* Desktops */
@media (min-width: 1025px) {
.container {
width: 80%;
max-width: 1200px;
}
}
Template Examples
News Template
File: news-view.html
<article class="news-item">
<header>
<h1>{%title%}</h1>
<div class="meta">
<span class="date">{%date%}</span>
<span class="author">{%author%}</span>
</div>
</header>
<div class="content">
{%content%}
</div>
<footer>
<div class="tags">{%tags%}</div>
<div class="rating">{%rating%}</div>
</footer>
</article>
Form Template
File: form-basic.html
<form method="post" action="{%action%}" class="sl_form">
<div class="form-group">
<label for="title">{%title_label%}</label>
<input type="text" id="title" name="title" value="{%title_value%}" required>
</div>
<div class="form-group">
<label for="content">{%content_label%}</label>
<textarea id="content" name="content" required>{%content_value%}</textarea>
</div>
<div class="form-actions">
<button type="submit" class="sl_button">{%submit_text%}</button>
<a href="{%cancel_url%}" class="sl_button secondary">{%cancel_text%}</a>
</div>
</form>