Nov 7, 2016

Iterating over string array in template in SDL Tridion 2013 SP1

Now we can add any string array to template package and iterate over its members in Dreamweaver template. We need to serialize your array and then create package string item out of it as mentioned below:

var list = new[] { "aaa", "bbb", "ccc" };           

StringWriter stringWriter = new StringWriter();
XmlSerializer xmlSerializer = new XmlSerializer(list.GetType());
xmlSerializer.Serialize(stringWriter, list); 

package.PushItem("ItemName",
                  package.CreateStringItem(ContentType.StringArray, stringWriter.ToString()));

The DWT for this array will be as:
  <!-- TemplateBeginRepeat name="ItemName" -->
    <div>@@Value@@</div>
  <!-- TemplateEndRepeat -->

Fixing Chrome resolution issue

There is a very simple solution it fix the chrome resolution issue. Follow the steps below:
  1. Find the Chrome icon that you click on. It may be on the Windows taskbar, a shortcut on the desktop, or in the start menu or on the start screen.
  2. Right-click the icon and select properties from the context menu if the icon is on the desktop or start menu/screen.If it is on the taskbar, right-click Google Chrome in the context menu that opens up and select properties here.
  3. The 'Target' field should end like this afterwards: chrome.exe" /high-dpi-support=1 /force-device-scale-factor=1
Click OK to confirm the change.