Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Device Layouts question View modes: 
User avatar
Member
Member
markcoatsworth - 5/9/2013 4:32:12 PM
   
Device Layouts question
Hello,

We have a client who wants to display some pages from their Kentico 7 site in a Facebook iframe application. So we need to create an alternate layout for these pages that is almost the same as the main layout, but optimized to the size of the iframe.

It seemed like using Device Layouts was a perfect solution to this problem. Our plan was create a device profile called 'Facebook', and this profile could use a macro to look for a query variable at the end of the URL. Then we append a variable like ?source=facebook to all of our Facebook requests -- this variable triggers the device profile -- and then we can see the device layout.

But it didn't work. Our other developer emailed the Kentico support team, and they said that device profiles must match a device in the ~/App_Data/CMSModules/DeviceProfile/devices.xml file before it evaluates the macro. This basically makes it impossible to use. Sure, I could add a new device with a user agent that adds my desktop browser. But the next time that Chrome and Firefox issue updates, then the user agent changes, and it won't match anymore.

Do you have any other suggestions how we could do this? Is there a way with the API that I could force a page to use a device layout before it is rendered? Please let me know,

Mark

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 5/16/2013 2:48:29 AM
   
RE:Device Layouts question
Hi,

I am not sure why using a custom device profile won't work for you. You can use the macro in its definition to check the query string value you want and then force this profile to be used.

Best regards,
Juraj Ondrus

User avatar
Member
Member
markcoatsworth - 5/21/2013 11:39:00 AM
   
RE:Device Layouts question
Thanks Juraj. We spent a long time trying to get the device profiles to work. But we were never successful. We tested the macro very carefully, but it never forced the device profile.

As I mentioned before, I think the device profiles only check the macro AFTER they match the user agent. But since user agents change so often, this is not a useful solution.

We eventually used a different solution by writing a custom webpart. It's not perfect but it works well enough for us.

Mark