Skip to main content

Field Injection Points in Layouts & Snippets

Insert field values exactly where you want them in your HTML/PHP templates โ€” visually and intelligently.

What Are Field Injection Points?

Field injection points allow you to visually reference and insert field values inside your Layouts or Snippets without writing raw PHP or Joomla code.

You define where each field appears using a simple, readable placeholder syntax like:

{field:my_field_alias}

At compile time, JCB replaces each placeholder with fully-rendered, Joomla-compliant PHP code that fetches and outputs the correct field value โ€” automatically respecting field type, formatting, permissions, and layout context.

This turns your HTML templates into clean, readable structures that adapt to each viewโ€™s schema without writing repetitive code.

Key Features

  • ๐Ÿงฉโ€‚Simple Placeholder Syntax
    Use intuitive tags like {field:my_field} anywhere inside HTML or snippet blocks.
  • โš™๏ธโ€‚Auto Rendering per Field Type
    JCB automatically renders the correct PHP or HTML for the field based on its type, display mode (edit/view), and Joomla version.
  • ๐Ÿ”โ€‚ACL & Visibility Aware
    Only injects data that the user has permission to see โ€” hiding sensitive or restricted fields based on Joomla ACL.
  • ๐Ÿง โ€‚Supports Conditional Logic
    You can wrap field injections with {if} or {foreach} control tags to loop through field arrays or check field existence.
  • ๐Ÿ“šโ€‚Works in Templates, Layouts & Snippets
    Field injection works across all frontend and backend views โ€” including Custom Admin Views, Site Views, and even email templates.

Example Use

Imagine a Site View called โ€œArticlesโ€ with fields like:

  • title
  • body
  • image
  • category

You can define a layout like:


{field:title}

{field:title}
{field:body}
Category: {field:category}

When compiled, this will render full PHP logic for each field, using the correct Joomla methods and escaping.

Usage Notes

  • All placeholders are replaced during compilation.
  • Fields must be part of the view the layout/snippet is linked to.
  • You can define a fallback like: {field:title|No Title Available}
  • Layouts can contain raw HTML, Bootstrap, UIKit, or any design framework.

Round-Trip Compatibility

  • You can edit compiled layouts and insert tags manually.
  • JCB supports Insert/Replace tagging, so round-tripping works seamlessly.

Why It Matters

  • Keeps templates clean and readable
  • Avoids hardcoded PHP logic in your views
  • Works with any Joomla version via JCBโ€™s dynamic rendering system
  • Ideal for designers or front-end developers collaborating on the same component

Related Features

  • Layout Builder
  • Template Builder
  • Snippets GUI
  • Field Definitions / Rendering Rules
  • Dynamic Field Visibility

Summary

Use field placeholders to dynamically inject data from Admin or Site views into your layouts and snippets, giving you precise control over how fields are rendered in the final component output.