Is it possible to exclude a template from using a layout template? Im looking to fetch some html from a hidden template and insert it into my page with JavaScript . The hidden template is including the site layout and I’d like to prevent that. Is this possible?
Interested in learning more solutions or want to get to know other EE users? Read more about joining the slack here! Join Our Slack!
No. The template layout process happens on the server before the HTML is sent to the browser, and so before the browser has any opportunity to run javascript.
It is possible for you to insert some hidden HTML into your page using javascript (or simply to build the page with the HTML hidden if that’s easier), so what you want to do can be done - just not by using the template layout system.
If the code is used in more then one place, you could put it in an embed, and include it in the template that has the layout and needs it, as well as the other template (without the layout)
Going to shift to embeds. Thx all!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.