How to insert a custom HTML div (map-canvas) into an Admin View? #997
Replies: 3 comments
-
Hi! You're on the right track using the Custom Code feature in JCB, but the issue seems to be about where and how the placeholder is being rendered in the layout. Here's what to check:
If you still get the Let us know how it goes! |
Beta Was this translation helpful? Give feedback.
-
I'm not sure I understood correctly. So, I insert the PHP code in admin view >> PHP? Isn't it necessary to use custom code? Then I was wondering, if I edit the file directly, won't it be overwritten when I compile the code? Thanks for the reply. |
Beta Was this translation helpful? Give feedback.
-
I'm sorry, I just noticed that the editor had broken the HTML code. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'm trying to insert a simple HTML div
<div id="map-canvas" style="height: 400px; width: 100%; border: 1px solid #ddd;"></div>
inside an existing Admin View of my component (the detail view with the editing form).
I tried using JCB's "Custom Code" feature, selecting Comment Type: HTML and Target: JCB manual. I pasted the div's HTML code there, saved it, and then took the generated placeholder (e.g., ``).
Subsequently, I attempted to insert this placeholder directly into the layout definition area of my Admin View (where the form's HTML is managed). However, this attempt resulted in a frontend error page with a PHP syntax error: syntax error, unexpected token "<". It seems the system is interpreting the HTML as PHP.
I've also searched the online documentation and the forum, but I haven't found a specific guide on how to correctly include arbitrary HTML directly within an Admin View's layout without causing syntax errors.
What is the correct method to insert an HTML block like the map div into a JCB Admin View without encountering syntax errors?
Beta Was this translation helpful? Give feedback.
All reactions