Using Snippets, Preload Replace Variables and the Parse Order
The king of the EE parse order, Low Schutte, has dazzled us once again with a great way to leverage the EE parse order to make your templates even more flexible and reusable than you thought possible. What do you get when take Snippets, Preload Replace Variables and the Parse Order? Super flexible templates that don’t have the overhead of embed templates. That’s what.
According to EE’s parse order, snippets are parsed first, before preload replace variables. These, in turn, are parsed before plugin and module tags, so both can be used as early parsed variables. This combination makes it possible to change the content of your snippet on a per template basis. Much like embeds and embed variables, but without the performance hit.
A series of Preload Replace Variables set your template values and then the snippet just uses those variables to pull in the right data. Read the entire blog post from Low (or, if you’re like me, read it twice) to get all of the details, including some sample code.
Very cool.