We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Nested layout inheritance breaking

Developer Preview

johndwells's avatar
johndwells
94 posts
11 years ago
johndwells's avatar johndwells

Much like the EE docs for templates, I have a template with a layout, and that layout itself has a layout. Yet when I try to run it, I get this message:

Plugin or module tag found before layout declaration. Please move the layout tag to the top of your template.

This setup was working in 2.8.1.

For testing purposes this is the general idea:

{!-- site/page.html --}
{layout="site/_page_layout.html"}

Ohai

{!-- site/_page_layout.html --}
{layout="site/_layout.html"}

Page says {layout:contents}!

{!-- site/_layout.html --}
<blockquote>"{layout:contents}"</blockquote>
       
Kevin Cupp's avatar
Kevin Cupp
791 posts
11 years ago
Kevin Cupp's avatar Kevin Cupp

Thanks, John. I ran into this too, I think it happens if your template has no {exp: tags in it. Try this fix and see if it works:

Open system/expressionengine/libraries/Template.php, find this code on line 585:

if ($tag_pos > $first_tag)

And REPLACE it with this:

if ($tag_pos > $first_tag && $first_tag !== FALSE)

Thanks for your reports lately!

       
johndwells's avatar
johndwells
94 posts
11 years ago
johndwells's avatar johndwells

Thanks Kevin, the code update works. FWIW, there were exp:channel:entries tags in both the parent template, its layout, and the layout’s layout. ¯_(ツ)_/¯

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
11 years ago
Kevin Cupp's avatar Kevin Cupp

Glad to hear! I think that makes sense, module tags can be present in parent templates but if any template that contains a {layout=} tag doesn’t have any module tags, that should be what’s triggering the bug.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.