You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/templates/partials.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,19 +25,23 @@ You can create and edit Template partials at `Developer --> Templates --> Templa
25
25
26
26
NOTE: **Note:** Template partials may not be nested inside other Template partials.
27
27
28
-
## Template partial vs. Template variable
28
+
## Template Partial vs. Template Variable
29
29
30
-
Template partials are expanded at a very early stage on each template, making it possible for them to hold dynamic content, ExpressionEngine tags, other variables, PHP, etc. (Read more about [the rendering stages of the template engine](templates/engine.md).) They shine when you need to reuse dynamic information but don't need the extra overhead of access control or separate preferences of an embedded template. [Template variables](templates/variable.md) are the polar opposites, expanded during one of the final rendering stages of the template engine, and should be used for static text, HTML, JavaScript, and other static content that would not affect other tags and variables on the template.
30
+
Template partials are expanded at an early stage in each template, which makes it possible for them to hold and control dynamic content, ExpressionEngine tags, other variables, PHP, etc. (Read more about [the rendering stages of the template engine](templates/engine.md).) They shine most when you need to reuse dynamic information but don't need the extra overhead of access control or separate preferences of an embedded template.
31
31
32
-
## Template partial vs. Embedded Template
32
+
[Template variables](templates/variable.md) are the polar opposites, expanded during the final rendering stages of the template engine, and they should be used for static text, HTML, JavaScript, and other static content that would not affect other tags and variables in the template.
33
33
34
-
Template partials can be considered to actually be part of the template that they are used on, with their expanded contents parsed simultaneous to other tags and variables on the template. [Embedded templates](templates/embedding.md) are separate templates, with their own preferences (caching, PHP parsing, access, etc.), and are parsed individually. Put another way, embedded templates are not _included_ in the parent template, but rather _added to them_ after the fact, using a separate query and full page parsing resources for each template.
34
+
## Template Partial vs. Embedded Template
35
+
36
+
Template partials behave as a natural part of the template that calls them, with their expanded contents inserted early and parsed simultaneously to other tags and variables in that template. They interact fully with the logic and data in the calling template.
37
+
38
+
[Embedded templates](templates/embedding.md) are more like sub-templates, with their own preferences (caching, PHP parsing, access, etc.). Embedded templates are processed individually after most of the calling template's parsing has happened. Put another way, embedded templates are not _included_ in the parent template, but rather _added to them_ after the parent template is mostly built, using a separate set of queries and using full page-parsing resources for each embedded template.
35
39
36
40
## Multiple Site Manager
37
41
38
42
TIP: **Tip:** If you are using the Multiple Site Manager, you'll notice that you have a new preference when editing each Template partial: make it available to all your MSM sites or this site only. To easily identify the difference when reading your templates, consider prefixing your Template partial names with the site's short name or, for Template partials available to all sites, _global_:
0 commit comments