Thursday, December 08, 2005

Reading sublayout's properties


Create a sublayout named “Document”, pass one parameter to it and performed publishing: The following code... Database db = Sitecore.Configuration.Factory.GetDatabase("master"); Item item = db.Items["/sitecore/content/home"]; string rend=item.Fields["__renderings"].Value; LayoutDefinition layout = LayoutDefinition.Parse(rend); DeviceItem dev = Sitecore.Context.Device; DeviceDefinition device = layout.GetDevice( dev.ID.ToString()); Item subl1 = db.Items["/sitecore/layout/Sublayouts/Document"]; RenderingDefinition rendering = device.GetRendering(subl1.ID.ToString()); Response.Write("Parameters: " + rendering.Parameters); ...should result the following output: Parameters: sab=sabvalue

0 comments: