Skip to main content

Layouts Reusable PHP Render Templates

enable modular, maintainable output logic that can be applied across Admin Views, Site Views, Templates, and Custom Admin Views

๐Ÿ” What Are Layouts?

Layouts are view render files written in PHP, often used for:

  • Displaying rows or items from Dynamic GETs
  • Structuring repeating elements like cards, tables, or tiles
  • Separating rendering logic from controller/model code
  • Enabling component-wide reuse of markup logic

Each layout supports:

  • Dynamic placeholders (e.g., {item->title}, {field.value})
  • JCB Snippets
  • JS and CSS libraries (linked via GUI)
  • Joomla-native layout loading conventions

Layouts are stored in:

  • /tmpl/layouts/ (in the compiled component)
  • Linked to by name from within Templates or Views

๐Ÿงฐ Where Layouts Are Used

  • Inside Site Views (list or item mode)
  • Within Custom Admin Views (to repeat or wrap data)
  • Embedded in Templates (as modular sections)
  • Reused across components as centralized UI logic

๐Ÿ“‹ Features

  • โœ… PHP-based rendering logic
  • โœ… Field and data placeholders
  • โœ… Supports Snippets and Library injection
  • โœ… GUI-driven linking and creation
  • โœ… Versioned and blueprint-aware
  • โœ… Can be nested within Templates
  • โœ… Compatible with round-trip compilation

๐Ÿ’ก Example Use Cases

  • A card layout for displaying product summaries
  • A table row renderer for list views
  • A compact preview box for item selections
  • Status badge layouts reused in admin and frontend

๐Ÿ” Maintenance & Version Control

Layouts can be:

  • Reset to master definitions from the repository
  • Forked for long-term project-specific use
  • Exported/imported as blueprint packages
  • Modified safely with round-trip placeholders

๐Ÿ“Ž Related Concepts

  • Snippets (for granular block logic)
  • Templates (for overall page rendering)
  • Libraries (for layout-linked JS/CSS)
  • Field Injection Points
  • Custom Admin Views

๐Ÿ“˜ Conclusion

Layouts are your componentโ€™s visual backboneโ€”powerful, reusable rendering units that let you separate markup from logic, enhance consistency, and avoid duplication. Use layouts when you want predictable, elegant control over how dynamic data gets presented across views.