Skip to main content

Line Tracking

Quickly trace compiled code back to its source โ€” down to the exact JCB entity and location.

What Is Line Tracking?

Line Tracking in JCB is a compiler-side feature that embeds comment-based metadata into generated PHP and layout files. These comments identify the origin of each compiled line or block โ€” whether it came from a view, layout, field, snippet, or template inside JCB.

It acts like a source map for your component: if youโ€™re inspecting compiled output in your IDE or troubleshooting a bug, youโ€™ll know exactly which JCB entity produced each part of the code.

Line Tracking makes debugging, customization, and round-trip edits dramatically easier, especially in complex components with dozens of views or reusable blocks.

Key Features

  • ๐Ÿ“ Source-to-Output Mapping: Each significant block of compiled code includes a comment that references the originating entity (e.g. view:admin.article.item, field:title, layout:form-default).
  • ๐Ÿง  Context-Aware Comments: The format of the comment includes the component, context (admin/site), type (view, layout, etc.), and entity name.
  • ๐Ÿ›  Automatically Injected During Compile: No manual work is needed. JCB adds tracking comments during each build automatically.
  • ๐Ÿ” IDE-Friendly & Readable: Comments appear in PHP, XML, and HTML files in a developer-friendly format that wonโ€™t break the code:
    // [JCB] From: layout.site.article.item.default
    <!-- [JCB] Generated from: field:publish_up -->
  • ๐Ÿงพ Supports Nested and Shared Logic: Tracks line origin even if the code was injected via a shared layout, snippet, or reusable field.
  • ๐Ÿงฌ Works with Custom Code Blocks: Line tracking wraps around custom code insertions as well โ€” helping you identify where your own snippets were injected.
  • ๐Ÿ“˜ Boosts Training and Team Collaboration: Developers unfamiliar with the blueprint structure can trace output back to its blueprint definition โ€” accelerating onboarding and edits.

Use Cases

  • Open a compiled model and see which view or field generated the save logic
  • Locate a generated layout block and find the responsible JCB template or snippet
  • Identify which shared field injected a specific database rule
  • Debug a misrendered field by locating its source in the GUI
  • Train new developers by letting them trace output to configuration in the backend

How to Use

No action is needed to enable Line Tracking โ€” itโ€™s built into the compile process.

  1. Open any compiled .php, .xml, .ini, or .html file.
  2. Scroll through the code and look for comments like:
    // [JCB] From: view.admin.orders.list
    <!-- [JCB] Generated from: layout.site.product.item -->
  3. Use these references to locate the entity inside JCB (e.g. Views โ†’ Admin โ†’ Orders โ†’ List).

๐Ÿง  Pro Tip: Combine Line Tracking with Insert/Replace tags for traceable custom overrides that persist across compiles.

Conclusion

Line Tracking gives you eyes inside the compiler. With every build, JCB leaves behind helpful breadcrumbs in your code, making debugging, auditing, and hand-editing not just possible โ€” but safe and understandable. Whether youโ€™re working solo or in a team, this feature keeps your component code traceable, teachable, and transparent.