Skip to main content

Reusable Custom Admin View Templates

Design once, use everywhere โ€” unlock speed, consistency, and maintainability in your backend interfaces.

What Are Reusable Custom Admin View Templates?

In JCB, a Custom Admin View Template is a structural layout (written in PHP/HTML) that defines the skeleton of how a backend interface should appear. These templates are tied to Custom Admin Views and provide a repeatable way to:

  • Render form fields
  • Show charts, buttons, or tabs
  • Inject layout-specific Snippets
  • Load JS/CSS libraries
  • Hook into custom logic with placeholders

Once created, a template can be linked to multiple Custom Admin Views, allowing you to maintain a consistent UI and behavior across views โ€” with only one place to maintain updates.

Benefits

  • Reuse layouts across similar views (e.g., all importers, dashboards, or utilities)
  • Apply changes globally by updating a single template
  • Reduce duplication and inconsistencies
  • Separate logic from design in your codebase
  • Enable collaborative design: developers can build logic, designers can update templates independently

How to Use It in JCB

  • Go to โ€œTemplatesโ€ under the JCB GUI
  • Create a new Template with HTML and PHP placeholders
  • Use Snippets to inject shared logic (looping, conditional display, tabs, etc.)
  • Optionally link libraries (CSS, JS) via the UI
  • In your Custom Admin View simply add - <?php echo $this->loadTemplate('template'); ?>

Template Architecture

A reusable Template may include:

  • PHP variables like $items, $field_map, or $this->get()
  • JCB placeholder tags for dynamic content injection
  • Looping or conditional logic for repeatable areas
  • Snippets linked to specific template blocks
  • Responsive containers, grid systems, or tab structures

This encourages clean, DRY (Donโ€™t Repeat Yourself) coding practices.

Real-World Examples

  • Importer dashboard template used across 5+ importer views
  • Tab-based layout template for multi-step admin tools
  • Full-screen statistical grid template reused in all analytics views
  • JSON API admin interface for monitoring webhook logs

Security & Control

  • Template logic compiles into Joomla-safe admin views
  • You can define ACL rules per view even if using the same template
  • Works with dynamic field injection and JS callbacks

Version Control & Sharing

  • Templates can be exported as entities via Git
  • Fork shared templates and evolve them per project
  • Reset templates to sync with shared repositories
  • Apply updates globally across all views using the same template

Summary

This feature lets you define templates for Custom Admin Views that can be reused across multiple views or even projects. It separates structural design from content logic, dramatically improving productivity and design consistency.