Site structure
Version 5.x > Site structure > "Insert new web part by reference to existing web part" View modes: 
User avatar
Member
Member
DesignByOnyx - 4/14/2010 1:17:40 AM
   
"Insert new web part by reference to existing web part"
I need to have little bits of reused content all around my site. Examples are configured web parts displaying latest news, newest products, breadcrumbs, calls to action, advertisements, list of services, etc. Some pages might use "latest news", "call to action", "list of services". Other pages might use "latest news", "newest products", "call to action".

PLEASE NOTE: I am very aware of Kentico's inheritance model. What I need is currently not possible with Kentico.

I have a bunch of ad-hoc templates which all have very similar content in different parts. Right now, I have to configure the same exact web part on multiple pages, which is a pain. It would be nice to reference an existing web part, and insert it into a template by reference only. That way I could update the web part in one place, and it would be updated in all places that reference it.

I hate to say these words on this site, but dot net nuke employs this "insert existing module" functionality. ("modules" are dnn's equivalent to "web parts"). You can then select any web part on the site and insert it by reference, or by cloning it.

User avatar
Certified Developer v7
Certified  Developer v7
Matt Mathias - 4/14/2010 4:30:35 PM
   
RE:"Insert new web part by reference to existing web part"
Have you tried creating inherited webparts? By creating a "new" webpart that inherits another webpart you can control the settings for that webpart in a central place and then put it on multiple pages.

For instance you could create a CMSRepeater that always had specific HTML Before and HTML After and then insert that into whatever pages you wanted. If you ever needed to change it you could just change this inherited webpart.


User avatar
Certified Developer v7
Certified  Developer v7
Matt Mathias - 4/14/2010 4:34:12 PM
   
RE:"Insert new web part by reference to existing web part"
Matt Mathias wrote: Have you tried creating inherited webparts? By creating a "new" webpart that inherits another webpart you can control the settings for that webpart in a central place and then put it on multiple pages.

For instance you could create a CMSRepeater that always had specific HTML Before and HTML After and then insert that into whatever pages you wanted. If you ever needed to change it you could just change this inherited webpart.



P.S.
I have screenshots I can send you if you want them.

User avatar
Member
Member
Jason - 1/6/2011 8:28:47 AM
   
RE:"Insert new web part by reference to existing web part"
Hi, would it possible to get those screenshots? I don't understand what it means to "inherit" a web part. I see how to clone a web part in the site manager, but not inherit.

We are trying to have the same static HTML web part on many pages, but we want to have it centrally managed. Do you have any suggestions on how to do this?

Thanks,
Jason

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/10/2011 6:38:57 AM
   
RE:"Insert new web part by reference to existing web part"
Hi Jason,


You can simply register the web part control (as any other ASP.NET controls) in the code of new web part (Developing web parts).

However, if you need a static HTML web part which content is centrally managed you can clone the current web part, insert the content to the Default value of Text field and disable it in the editing mode. Then the text content is not editable in CMSDesk and all the instances of this web part uses the same (default) content which you can edit in Site manager -> Development -> Web parts.


Best regards,
Helena Grulichova

User avatar
Member
Member
DesignByOnyx - 5/19/2010 10:39:41 AM
   
RE:"Insert new web part by reference to existing web part"
Hey, sorry I was not subscribed to this post, and was not aware of your comment until now.

To answer your question, yes I have cloned web parts and pre-configured them to my liking, which is just a tedious way of achieving what I need. This method clutters up the web part gallery, and it is a painstaking process of adding the "common" fields just so I can set their default value.

I appreciate your response. Since my post I have had a good "come to jesus" with our designers and marketing team, explaining to them how visual inheritance works in Kentico so that they can design a more consistent look and layout. However, it would still be neat to reference an existing web part in a site ;)

Oh by the way, "ad-hoc template regions" would also be really cool so that 10 pages could share the same template, but some of those pages could have an extra region in the left column. Just a thought. No need to respond.

Cheers
~Ryan

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 5/22/2010 6:20:05 AM
   
RE:"Insert new web part by reference to existing web part"
Hi Ryan,

I've passed your feature suggestion regarding "ad-hoc template regions" to our Product Manager and he will consider adding it into one of future versions of Kentico CMS.

Best Regards,

Martin Dobsicek