Skip to main content

Template Builder

Design complete view structures for your Joomla components with full control over layout, rendering, and assets — all visually inside JCB.

What Is a Template?

In Joomla Component Builder (JCB), a Template is a high-level wrapper that organizes how one or more Layouts (and optionally Snippets and Libraries) are applied to a given view — whether Site View, Modules, or Custom Admin View.

Where a Layout handles the specific rendering of content (like a list or item), a Template defines the full structure of the page or view. It may control multiple layout regions, add external libraries (JavaScript/CSS), and serve as the entry point for custom design frameworks or data logic.

Key Features

  • 🧱 Layout-Driven
    Templates reference one or more Layouts that define the actual content rendering — separating structure from logic.
  • 📁 Library Injection
    Load JavaScript or CSS libraries (local or CDN) for use in the template — including UI frameworks, charting libraries, or animations.
  • 🧩 Snippet Support
    Templates can reference reusable Snippets (HTML/PHP) to render toolbars, modals, breadcrumbs, or utility blocks.
  • 🔁 Reusable Across Views
    A single template can be used in multiple views — enabling visual consistency across your admin or site pages.
  • 🎯 Dynamic Placeholder Injection
    Insert JCB variables or logic into templates via PHP placeholder keys.
  • 🧬 View-Type Aware
    Templates can be built specifically for list, item, or hybrid views and adapt their structure accordingly.
  • 📦 Versionable & Resettable
    Templates support Git-style entity workflows: you can init, reset, push, and fork template definitions like any other JCB entity.

Template vs Layout vs Snippet

Entity Description Scope
Template: Wraps a view’s full UI, injects layouts/libraries/snippets Full View (High-Level)
Layout: Defines specific render blocks for items/lists Partial Content Block
Snippet: Small reusable UI piece (e.g., button, message) Inline or Nested

Layouts are injected into Templates. Snippets can be embedded in Layouts.

How It Works

  • Go to the Templates section in JCB.
  • Create a new Template and give it a name and description.
  • Assign one or more Layouts for the content rendering.
  • Optionally inject JS/CSS Libraries by selecting from the repository or entering a URL.
  • Insert Snippets or logic placeholders for reusable regions (toolbars, notices, actions).
  • Assign this Template to any view (Site or Admin).
  • On compilation, JCB builds a PHP view file that wraps all child elements.

Example Use Cases

  • Wrapping a Site View in a Bootstrap or UIkit layout with external scripts
  • Creating a reusable card-based admin interface
  • Adding modal logic and script loading for import tools
  • Rendering header + content + footer sections with toggleable sections
  • Integrating visual dashboards with Chart.js, D3, or ECharts

Why Templates Matter

  • Centralize view structure for consistent styling
  • Minimize repeated layout logic across views
  • Enable clean injection of JavaScript/CSS dependencies
  • Separate presentation concerns from business logic
  • Adapt the output of your Joomla component with design-focused flexibility

Libraries: Local or CDN?

Templates let you inject JS/CSS assets either by referencing a local file or a remote CDN. You can:

  • Add libraries via the Library entity and link them in the Template
  • Use the CDN/Local toggle to control delivery per environment
  • Update and reset libraries via JCB repositories