Hi
In the past I’ve always used embed to call one header and footer to each page, but would there be an advantage to making them snippets instead?
Thanks
Andy
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
July 12, 2011 6:53am
Subscribe [4]#1 / Jul 12, 2011 6:53am
Hi
In the past I’ve always used embed to call one header and footer to each page, but would there be an advantage to making them snippets instead?
Thanks
Andy
#2 / Jul 12, 2011 9:16am
A good rule of thumb for performance is to use a snippet unless you need to use an embed. The places you need to use an embed is where scope is important. For instance, if you need to have an entries loop inside an entries loop you will need to use an embed instead of a snippet.
However, I prefer to only use snippets for small pieces of a template because I save templates as files and use git for version control. It is really of balancing act depending on your needs.
#3 / Jul 13, 2011 1:08pm
I wrote a bit of an article on the topic for Train-ee:
http://www.train-ee.com/courseware/free-tutorials/comments/snippets-or-embedded-templates/
In my own development I’ve done what the3mus1can suggests.
#4 / Jul 14, 2011 12:28pm
I usually only use snippets if there are parts of the template that I want the client to be able to edit safely (since I seldom if ever give them access to the templates section).