Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Programatically decide inherited levels View modes: 
User avatar
Member
Member
andrija-netcom - 3/10/2011 5:00:52 AM
   
Programatically decide inherited levels
Hello,

I was wandering if it was possible to decide inherited levels programmatically.

What I'd like to do:
I have a page that is child of MasterPage. MasterPage has company logo, navigation and 2 sidebars.
I'd like to be able to use that page in iFrame from different site. Obviously, I'd like to hide the MasterPage content.

So, ideally, request to that page would be something like domain.com/page.aspx?InheritedLevel=-1 (meaning none).

If it is possible, how could I do it?

Best regards,
Andrija Frlan

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 3/24/2011 8:24:12 AM
   
RE:Programatically decide inherited levels
Hello,

Well, in short, it's not possible to get dual behavior in one page.
You could however create some special page, that will contain a Page Placeholder webpart and specify the page template...
However, it will again probably be without the content (texts)...

Maybe trying some different approach, further details about your aim could tell us more...

Regards,
Zdenek

User avatar
Member
Member
andrija-netcom - 3/24/2011 8:37:53 AM
   
RE:Programatically decide inherited levels
Hi,

I've "solved" my issue by following workaround:
Header, footer and sidebars are hidden. Using javascript, i make them visible if hideMasterPage parameter is not prezent in request.
If present, I update all domain links on page to contain that parameter so that further requests would behave in the same way.

Best regards,
Andrija Frlan

P.S. If anybody comes up with a real solution, I'd like to hear about it.

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 3/29/2011 8:37:59 AM
   
RE:Programatically decide inherited levels
Hi,

Thanks for sharing your solution here.

Actually an alternative solution to javascript, at least for hiding the elements, would be to encapsulate those parts into Webpart zones and use querystring macro expressions for zone visibility property.

To be more specific, you would have let's say a header, footer and sidebars webpart zone(s).
The main content zone with page placeholder (for child page) will be separated.
Then, if you set the "Visible" property of those 3 webpart zones (you will need to open the zone properties dialog and click the small black arrow next to the "Visible" attribute checkbox to enter the macro) like:

{%hideMasterPage != "1"%}

Then, when "?hideMasterPage=1" is present in the URL, those webpart zones won't be displayed. It is probably better than using javascript, because the content is not even rendered, and if there were many webparts in header, footer and sidebar zones, it may give some performance spare. That's because when the zone is hidden, none of the webparts is resolved and the processing ends in the beginning.

Hope this will be useful for your aim.

Regards,
Zdenek