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:
The DWT for this array will be as:
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 -->
No comments:
Post a Comment