ASPX templates
Version 4.x > ASPX templates > Template Custom Properties View modes: 
User avatar
Certified Developer 10
Certified Developer 10
oleg-webcoda.com - 9/24/2009 1:32:07 AM
   
Template Custom Properties
Hi,

Is there a way to specify custom properties at a template level.
Simple example would be a page template called "Document" with custom property "Type". When user creates a new page using this template he can specify the type.
Depending on the value entered by the user, the template will do something different.

Thanks for you help,
Oleg.

User avatar
Certified Developer 10
Certified Developer 10
oleg-webcoda.com - 9/25/2009 8:17:38 AM
   
RE:Template Custom Properties
Hi,

It looks like WebParts will work well for this e.g. I can define attributes for the webpart and get the user to provide values that I can use on my WebPart .

However I cant work if it is possible to use the WebPart on the ASPX page template.

I'd like to have the WebPart to be embeded on the ASPX page template (e.g. user can't move/remove it) but so that the user can still set its attributes.

Is this possible?

Thanks,
Oleg

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 9/28/2009 3:00:45 PM
   
RE:Template Custom Properties
Hi,

Web parts are mentioned only for portal engine and not for ASPX templates approach. However, you can combine these two approaches:

http://devnet.kentico.com/docs/devguide/combining_aspx_templates_and_portal_engine_templates.htm

I’m not aware of any easy solution to your request which would be able to accomplish without source code version of Kentico CMS.

Best Regards,
Miroslav Remias.

User avatar
Certified Developer 10
Certified Developer 10
oleg-webcoda.com - 9/28/2009 6:40:06 PM
   
RE:Template Custom Properties
Hi,

Thanks for you response.
The reason we can't use the Portal Engine templates is because we using whitelableing on the site e.g. switching master pages dynamically based on some runtime conditions.

What I have done to achieve our objective is to combine the Cms Templates and Document Types:
1. I create a document type and defined required form attributes on this doc type.
2. Created Cms Template that loads the custom properties from the underlying doc type e.g. int ProductCategoryID = (int)CMS.CMSHelper.CMSContext.CurrentDocument.GetValue("ProductCategoryID");
3. When user creates a new page, he needs to:
a. Create new document type
b. Apply correct Cms Template to this document type.

Now during the page creation, a set of custom values can be passed to the underlying Cms Template.

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 9/29/2009 3:59:48 AM
   
RE:Template Custom Properties
Hi,

I was just about to advice you similar approach. However, you can configure your custom document type to use specific page template, so the user does not need to select the template manually when creating new document in CMS Desk.

Best Regards,
Miroslav Remias.