Wednesday 10 July 2013

Transformation?!


Undoubtedly, we would use transformations and CMSRepeater to display document type data under portal engine. How about ASPX template? if we follow developer guide, we would construct a CMSRepeater like below:

<cms:CMSRepeater id="Repeater_Sample" runat="server" path="./%" class="page.menu" transformation="page.menu.title"></cms:CMSRepeater>

However, CMSRepeater inherits from asp.net repeater control. Transformation content can be placed in the Item Template. For example,

<cms:CMSRepeater id="Repeater_Sample" runat="server" path="./%" class="page.menu">
  <ItemTemplate>
    <%#Eval("Title")%>
 </ItemTemplate>
</cms:CMSRepeater>

Which approach would you prefer? I found there are a couple of advantages to use the latter approach.

Save time


If you have a bad internet connection or local/staging hardware, editing transformation may drive you crazy. Using Item Template saves you lots of overheads. It is also easier to implement nested repeater, surely Intellisense would speed up the process. You may also use Header Template, Alternating Item Template, Footer Template and ... as well.

Versioning & Deployment


Kentico version 7 provides versioning on transformation. It is definitely helpful. However, it is not enough. I can use Git and utilise the advance version tools, such as branching, diff editor and etc to manage my codes.

Also, although content staging handles all transformation updates and publish to other Kentico instances easily, it would be hard to deploy only one of many changes under same document type. In this situation, Git branching could handle it.

If using transformation, it takes few extra steps to dump all virtual objects to physical files for compilation under pre-compiled environment.

Advantage of Transformation

Transformation allows you to edit the site directly through the CMS interface. You do not need to upload any files. If your site under pre-compile environment, you can use text‑based transformations. Direct edit still possible.


What do you think? How do you use CMSRepeater?

No comments:

Post a Comment