Package DE_EPAGES::Presentation::API::TLE::IncludeTemplateHandler
Provides TLE functions and variables for partial page caching. The TLE block CachedInclude can be used to cache a part of a page that would normally not be cached. This is useful for content areas that are mostly static but take a long time to compute. If the content is not completely static, you must specify a cache file name that includes the parameter on which the content depends. For example, if the content depends on the language and the currency, the file name should include the current currency is and language id. There are some pre-defined file name parts for most common scenarios, such as #CacheIncludesPrices for page parts that contain locale and currency dependend content. See function tle for details.
Example |
#BLOCK("CachedInclude", #Object, "MyPageType.MyInclude" . #INPUT.Language . #INPUT.Currency) #NameOrAlias: #Price[money] #ENDBLOCK #BLOCK("CachedInclude", #Object, "MyPageType.MyInclude" . #CacheIncludesPrices) #NameOrAlias: #Price[money] #ENDBLOCK |
Functions
CachedInclude
Caches the content of the block in a static file. The cached content can be reused in other templates if the object and file name are equal. The function uses cache settings of the site to invalidate the stored page.
Syntax |
#BLOCK("CachedInclude", #Object, #FileName) ... #ENDBLOCK #BLOCK("CachedInclude", #Object, #FileName, #Condition) ... #ENDBLOCK |
Example |
#BLOCK("CachedInclude", #Object, "SF.CategoriesLinkList" . #CacheIncludesNames) #LOOP(#Shop.Categories.VisibleChildObjects) <div><a href="?ObjectPath=#Path[url]">#NameOrAlias</a></div> #ENDLOOP #ENDBLOCK |
Input |
|
IncludeTemplateViaObject
Includes a template from a different page type. This allows to show the content of a product detail page in the context of a category page.
Syntax |
#FUNCTION("IncludeTemplateViaObject", #Object, #Template, #ViewAction") |
Example |
#BLOCK("Pager", #VisibleProducts, 1) #LOOP(#Pager.Items) #FUNCTION("IncludeTemplateViaObject", #Object, "Content", "View") #ENDLOOP <div class="PagedProduct">#INCLUDE("Pager")</div> #ENDBLOCK |
Input |
|
InlineEditor
Includes a inline editor for different types of data if the template will be processed at the Backoffice.
Syntax |
#BLOCK("InlineEditor", #Type, #Object, #Attribute, #Info)Template#ENDBLOCK |
Example |
#BLOCK("InlineEditor", "html", #Object, "Description", "Tag=SPAN;Class=Description") #IF(#Description) <div class="Description">#Description[0]</div> #ENDIF #ENDBLOCK |
Input |
|
LocaleInclude
Includes a template with locale-specific content. The function implements a fallback mechanism: If the template "#Template-#Locale" (e.g. "ShopAddress-DE") does not exist, then it includes the template without the locale extension (e.g. "ShopAddress").
Syntax |
#FUNCTION("LocaleInclude", #Template, #Locale) |
Example |
#WITH(#Shop.Address) #FUNCTION("LocaleInclude", "ShopAddress", #Country.Code2) #ENDWITH |
Input |
|
SNIPPET
SNIPPET combines LOCAL and INCLUDE to one function.
Syntax |
#SNIPPET("IncludeTemplate", #KeyString, #Value1, #Value2, ...) |
Example |
#SNIPPET("INC-WYSIWYG", "Name,Value,Head,Help", "Description", #Description, #TRANSLATE("Description"), #TRANSLATE("BubbleHelpDescription")) same as #LOCAL("Name", "Description")#LOCAL("Value", #Description) #LOCAL("Head", #TRANSLATE("Description"))#LOCAL("Help", #TRANSLATE("BubbleHelpDescription")) #INCLUDE("INC-WYSIWYG") #ENDLOCAL#ENDLOCAL#ENDLOCAL#ENDLOCAL |
Input |
|
SavedInclude
Caches the content of the block in a static file. The cached content can be reused in other templates if the object and file name are equal. The function ignores the cache settings of the site. See also: DE_EPAGES::Object::API::Object::Object::clearSavedPages
Syntax |
#BLOCK("SavedInclude", #Object, #FileName) ... #ENDBLOCK |
Example |
#BLOCK("SavedInclude", #Site.Object, "MBO.Menu" . #CacheIncludesNames) menucontroller.registerChildren([ #MENU("Menu") #INCLUDE(#Template), #ENDMENU null]); #ENDBLOCK |
Input |
|
tle
These TLE variables can be used to create special file names for partial page caching with CachedInclude blocks. The generated file names make sure that a unique file is used when the cached context depends on some context, for example if different content would be generated depending on the selected language or currency.
- CacheIncludesNames - content depends on language only - string
- CacheIncludesPager - content includes a pager and therefore depends on Page, OrderBy, OrderDesc, PageSize and PagerSize - string
Syntax |
#BLOCK("CachedInclude", #Object, #Prefix . #CacheIncludesNames) |
Example |
#BLOCK("CachedInclude", #Object, "Name" . #CacheIncludesNames) #NameOrAlias #ENDBLOCK |