cavin dot name Fractals, Arts, Programming & Rambles

Creating Custom Themes & Templates

CSE_CMS v2 strictly separates structure from appearance:

  • Templates (templates/<slug>/) control where elements sit on the page (sidebar left, sidebar right, top navigation bar, minimalist single column, etc.).
  • Themes (themes/<slug>/) control how elements look (colors, fonts, borders, shadows, dark/light palettes, banner accent tint).

Both directories are auto-discovered — dropping a new folder into templates/ or themes/ immediately makes it selectable in the sidebar's Appearance panel!


How to Create a New Theme

A theme is just two files inside themes/my-theme/:

  1. themes/my-theme/theme.json:
    {
      "name": "My Theme",
      "description": "Warm parchment light theme"
    }
  2. themes/my-theme/theme.css:

    Override any of the CSS custom properties defined in assets/css/base.css:

    :root {
      --bg: #f8f5ee;
      --bg-accent: linear-gradient(135deg, #3b2f2f 0%, #5c4033 100%);
      --surface: #fffdf8;
      --surface-alt: #f3ede2;
      --text: #2b2118;
      --text-muted: #6e5c4f;
      --border: #dfd3c3;
      --accent: #b45309;
      --accent-hover: #92400e;
      --accent-soft: rgba(180, 83, 9, 0.12);
      --banner-accent: #f59e0b;
      --banner-opacity: 0.85;
      --radius: 10px;
      --font-body: Georgia, "Times New Roman", serif;
      --font-heading: system-ui, sans-serif;
    }

The HTML5 banner animation automatically reads --banner-accent (falling back to --accent) so all animations harmonize with your theme automatically!


How to Create a New Template

A template lives in templates/my-layout/ with two files:

  1. templates/my-layout/template.json:
    {
      "name": "My Layout",
      "description": "Custom editorial layout"
    }

    (Add "hidden": true if the template is only for internal use like exbed.)

  1. templates/my-layout/layout.php:

    Standard HTML5 + PHP template. Include head.php and widgets.php partials and place the provided view variables wherever you want:

    • $site_title, $site_tagline, $page_title, $body_html, $copyright
    • $breadcrumbs, $languages, $top_categories, $sub_categories
    • $toc_html, $hot_links, $stats, $templates, $themes
    • cse_render_brand($site_title) for the animated brand mark
    • $effect_attrs on <body> to enable configured visual effects

Use templates/classic-sidebar/layout.php or templates/minimalist/layout.php as a starting point.


Shareable Preset Links

Any URL on the site accepts optional template and theme query parameters, which immediately apply and save both choices in the visitor's cookies:

https://your-site.example/en/?template=vintage-cse&theme=cse-2008

This lets you share a link pre-configured with a specific layout and look!