Blog

New Features from ExpressionEngine: Layout Tags

The tools we use continually improve to perform better than they already do, and today we’ve chosen to highlight one of the newer features of our favorite content management system Expression Engine. While it already presents a robust system that grows with your website, EllisLab continues to develop useful features that make development more efficient and flexible.

Once such feature is the new {layout} tag in version 2.8. While we’ve previously used the {embed} tag to create our layouts, the way we used it and structured our code created a lot of repetition; each page held page contents sandwiched between a header and footer embed.

Standard way of coding in EE
Standard way of coding in EE

With the new layout tag, we’re able to further separate out our “master layout” from our content, simplifying our layouts and clearly defining how our master layout is related to our content.

Simple example of how to use the {layout} tag
Simple example of how to use the {layout} tag

By removing too many iterations of what we would have on the page, we can not only create faster websites, but we can also increase our workflow efficiency, and better efficiency is always awesome.

With a more complex layout where the homepage layout has major differences from the secondary layouts, we might choose to restructure the pages so that the secondary layout can be based off the “master” layout, thus further separating the secondary layout from the actual content. Secondary code might differentiate within the secondary pages as well, further allowing us to potentially differentiate which layouts can be used for which secondary pages.

Complex example of how to use the layout tag
Complex example of how to use the layout tag

The layout tag opens up a world of possibilities in code structuring and organization between “layout” and “content”. Repetition in coding is now minimized, especially with the ability to base layouts off layouts, which can be based off other layouts.

Tune in next time for more updates on the new and exciting features the web team is exploring!

“Template Layouts in ExpressionEngine 2.8”, EllisLab Blog


Les Kyono

"On numerous occasions we needed Westminster's help to get something created and delivered at the last minute. Every time Westminster delivered, even if that meant the owner had to personally pick up and deliver the items to us."

NetApp