Portal Engine
Version 2.x > Portal Engine > Overriding web parts in parent template View modes: 
User avatar
Member
Member
persun - 1/4/2007 2:40:54 PM
   
Overriding web parts in parent template
Hi,

For the site I am working on at the moment I have the need to insert content between the main menu (top part of the header) and the bottom part of the header on a couple of my pages (the home page, for instance). The header should appear on all pages and is therefore a part of my master template. How can I insert content in the middle of the header without completely disconnecting my home page (and similar pages) from the master template? I already have a pageplaceholder in my master template below the header (the page body).

Is there any way to hide web parts in a parent template on a certain page?

or even better...

Could Kentico be modified so that web parts in a parent template can be overridden (moved, replaced, added etc) by a child template?

Any ideas?

Thanks,

Per

User avatar
Member
Member
ericcone - 1/5/2007 5:14:01 AM
   
Re: Overriding web parts in parent template
It sounds like you want to have the same HTML add to a few pages on your site.

Here is the quickest solution that I can think of

Make a copy the CMSWebParts\Text\staticHTML.ascx file.
Rename the copy addedHTML.ascx.
Put your HTML in the "ltlText" literal.
<asp:Literal ID="ltlText" runat="server">HTML goes <B>HERE!</B></asp:Literal>
Next add a webpart under the site manager/development/webparts that uses the new addedHTML.ascx
Lastly, open each page that you want to the content on and add the webpart to the Design.

Another quick option would be to add the StaticHTML webpart to each page. You would need to keep all of the pages insync with the same content. The first option would allow you to change or take down the content without revisiting all of the pages.

User avatar
Member
Member
ericcone - 1/5/2007 5:19:00 AM
   
Re: Overriding web parts in parent template
If putting the HTML in the actual literal doesn't work, then simply put it outside of the literal (before or after). Putting the HTML outside of the literal will allow you to use the same piece of HTML on all of the pages that have the same WebPart. Plus, the webpart still works just like the staticHTML webpart except that it has HTML before or after the editable text.


User avatar
Guest
admin - 1/20/2007 5:59:08 PM
   
Re: Overriding web parts in parent template
Hello,

a general solution for this requirement would be this:
- create an article with content that you want to display in the header under each section - e.g.:

- Home
--- Main text
- News
--- Main text
- About Us
- Contact Us
--- Main text

and place a Repeater web part into your master page. Configure the Repeater web part to display articles and set the path to /{0}/MainText which ensures that it loads the Main text document of the given site section. When the document is not created for the current section, it will not be displayed.

Best Regards,