The custom render tags API documentation now contains the first two getting started examples for implementing a custom render spot and a custom object loader. These two examples show how to build a simple syntax for accessing global constant values like the text resources in the Best Practices Project more easily by just using two commands within your template:
<%%
InitializeFromPage(A8EE657A1A8446CF90437A74B5CFEC6D) %%><div id="header" role="banner">
<!IoRedDotOpenPage>
<!IoRangeNoEditMode>
<%% stdLabelOpen %%>
<!/IoRangeNoEditMode>
<!IoRangeRedDotEditOnly>
<%% stdLabelClose %%>
<!/IoRangeRedDotEditOnly>
instead of using the more complex, redundant and more error-prone builtin commands like this:
<div id="header" role="banner">
<!IoRedDotOpenPage>
<!IoRangeNoEditMode>
<%!!
Context:Pages.GetPage(Guid:A8EE657A1A8446CF90437A74B5CFEC6D).Elements.GetElement(stdLabelOpen).GetHtml()
!!%>
<!/IoRangeNoEditMode>
<!IoRangeRedDotEditOnly>
<%!!
Context:Pages.GetPage(Guid:A8EE657A1A8446CF90437A74B5CFEC6D).Elements.GetElement(stdLabelClose).GetHtml()
!!%>
<!/IoRangeRedDotEditOnly>
Both examples come with full source code and compiled assembly. Read more on OTDN here.
Keine Kommentare:
Kommentar veröffentlichen