Skip to main content

Layout Builder

Effortlessly structure how your Joomla views are rendered โ€” with reusable, PHP-based layouts that you control entirely via the JCB GUI.

What Is a Layout?

A layout in Joomla Component Builder (JCB) is a reusable PHP file that defines how a specific part of your componentโ€™s output is rendered โ€” typically a list view, item view, or a custom interface section. Layouts serve as structural templates, separated from business logic, and are injected into Site Views, Custom Admin Views, and Templates via the JCB GUI.

Key Features

  • ๐Ÿ“โ€‚GUI-Based Assignment
    Easily assign layouts to views using a simple code snippet โ€” <?php echo LayoutHelper::render('layout_name', [?]); ?>>.
  • ๐Ÿ”โ€‚Reusable Structure
    Create once, reuse anywhere: layouts can be used across multiple views and components.
  • ๐Ÿ“„โ€‚Snippet Injection
    Use Snippets (partial templates) inside layouts for modular, maintainable rendering.
  • ๐Ÿง โ€‚Dynamic Data Injection
    Access Dynamic GET results or JCB placeholders directly in layout output.
  • ๐ŸŽจโ€‚Stylable & Extendable
    Load JavaScript/CSS Libraries (like UIkit, Chart.js, Bootstrap) to extend your UI directly from JCB.
  • ๐Ÿ“ฆโ€‚Git-Friendly & Resettable
    Layout definitions are versionable: pull updates, reset from source, or fork your own variants.
  • ๐Ÿ“ƒโ€‚Override-Compatible
    Generated layouts support Joomlaโ€™s native override system โ€” just like core components.

Typical Use Cases

  • List views for custom admin views or site content
  • Item detail renderers (custom profiles, logs)
  • Dashboard layouts with charts or metrics
  • Custom workflow or step-by-step UI interfaces
  • Modular injection into Site or Custom Admin Templates

Layout vs Template vs Snippet

Entity Purpose
Layout: Renders a specific html layout with php injected data
Template: Groups layouts/snippets for whole views
Snippet: Reusable partial UI (e.g., button block)

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

Workflow

  • Go to Layouts in JCB.
  • Create a new layout with a filename and description.
  • Insert your PHP/HTML logic, placeholders, or snippet keys.
  • Optionally attach libraries (JS/CSS).
  • Compile โ€” the layout appears under /layout in your component.
  • Customize further with overrides, version control, or dynamic logic.

Why Use Layouts?

  • Decouple logic from presentation
  • Maintain reusable design patterns across projects
  • Let non-developers adjust layouts visually in JCB
  • Reduce complexity of frontend/backend view design
  • Maintain DRY code through snippets and layout inheritance