Friday, January 20, 2012

Displaying EditableRegion content in transformations

For a website we are developig using Kentico CMS we wanted to show summaries of subpages of the current page. Along with the name of the document, there should be the introduction tekst from the page. The introduction is entered on the subpage in an editable region.

The menu control uses transformations to show title, date etc. With the following code snippet, any editable region field can be retrieved in the transformation.



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
private String GetField(String alias, String field)
{
     // Get the page info
     CMS.PortalEngine.PageInfo pi =
          CMS.PortalEngine.PageInfoProvider.GetPageInfo(
               CMS.CMSHelper.CMSContext.CurrentSiteName,
               alias,
               CMS.CMSHelper.CMSContext.CurrentDocument.DocumentCulture,
               "",
               true);

     if (pi != null)
     {
          // Get the field
          if (pi.EditableItems[field] != null)
          {
               return pi.EditableItems[field].ToString();
          }
     }
     return String.Empty;
}

Put this code in a Function library or put it in your transformation directly using <script runat="server"> </script> tags.

To call the function in a transformation use to following in your Transformation:


1
<%# GetField((string)Eval("NodeAliasPath"), "textintro") %>

2 comments:

Unknown said...

Furniture 3D Model Design Tips
Furniture design is a specific area of interior design that has been going through some major changes in recent years. One of the most innovative and up-to-date trends in furniture design is 3D modeling. In this blog post, we will introduce you to the benefits of 3d modeling for your next furniture project!

A full-scale 3D rendering lets you get a real sense of what your final product will look like before it’s manufactured. This saves you time, money and frustration by giving you a precise idea of how your furniture will look in real life. It also helps with the visualization process when it comes to furnishing spaces that have yet to be designed or built.


Ever had the urge to create your own furniture but didn’t know how? It’s not as hard as you think! With these handy tips, you’ll be designing like a pro.
Find inspiration for your furniture 3d models design on hum3d.com.
Designing furniture is all about creativity and finding what fits your taste. There are plenty of ways to find inspiration: look at things in nature, watch movies or TV shows, browse home design websites, or find pictures online. The best way to get started is by picking one thing that you like and seeing how it inspires the rest of the design process.

Vanessa said...

Thiss is a great post