Site structure
Version 5.x > Site structure > Choosing a template for the article when creating via form View modes: 
User avatar
Member - 9/23/2011 4:36:21 AM
Choosing a template for the article when creating via form
Hi all,

Hope you can help / have tried this before.

What I am trying to achieve is the ability to create say 10 different layouts for the CMS.Article Document Type and then when one of our content editors uploads a new article I can give them a drop down on the form to choose the template required.

i.e. Layout 1 has Image top left, Layout 2 has image halfway down on right, Layout 3 is more Newspaper like.

It would allow us to easily give a new level of flexibility at the article level but my attempts so far have not been successful.

Your thoughts appreciated.


User avatar
kentico_michal - 9/26/2011 3:41:13 AM
RE:Choosing a template for the article when creating via form

You can create a new form control with a standard drop-down list control displaying all available templates and letting users to choose one of them. You can find some inspiration in Kentico CMS Template selector (~\CMSModules\PortalEngine\FormControls\PageTemplates\SelectPageTemplate.ascx.cs).

This control would need to return a TemplateID of the selected template.

Then, you need to use the form control in a system attribute DocumentPageTemplateID [Site manager -> Development -> Document types -> edit document type -> New System attribute -> Attribute name: DocumentPageTemplateID , Field type: <custom form control>]

Best regards,
Michal Legen