Site structure
Version 5.x > Site structure > Kentico mobile pages View modes: 
User avatar
Member
Member
jwieczorek-pgs-soft - 12/8/2011 8:49:20 AM
   
Kentico mobile pages
Hi,
I want to create mobile web pages, which has the same content as original. Mobile web page has raw style and another template. I used repeter to get list of articles from original page, but if I want to open the article I don't know what to do to open it with mobile layout, not web page old layout?

User avatar
Member
Member
lancetek - 12/8/2011 9:21:35 AM
   
RE:Kentico mobile pages
See: http://devnet.kentico.com/Forums.aspx?forumid=48&threadid=12889 For a thread on mobile development.

It seems that officially the Kentico best practice suggests to duplicate your content for a mobile device - this is because each document may only have a single template.

But - you can do various other clever things to avoid duplicating your content:
1 - You could create a single page that takes a document Id as a parameter on the querystring and renders the contents of that document using a different template.
2 - You could use a few repeaters on the document template, one that shows the document for a desktop, but hides on a mobile, and another repeater that shows the mobile version and hides for the desktop. So you'd need some way to detect that a mobile browser was being used - cookies, querystring or path are the most obvious.

Lance

User avatar
Member
Member
jwieczorek-pgs-soft - 12/12/2011 10:23:15 AM
   
RE:Kentico mobile pages
Could you give me any clues, how to create pages which takes arguments?

User avatar
Member
Member
lancetek - 12/12/2011 12:54:28 PM
   
RE:Kentico mobile pages
Here is where you want to start: http://devnet.kentico.com/Documentation.aspx

You can use arguments just about any page - what you do is use a Macro to read the querystring. You use this as an argument inside a control like a repeater. To create the links with querystring args, you'll have to update your links and other web parts like repeaters.

See: http://devnet.kentico.com/docs/6_0/devguide/index.html?types_of_macros.htm for the definition of the macros.

eg: You have Articles that you want to view. You'll need an Article List (articleList.aspx) page and an Article Detail (articleDetails.aspx) page.

In the Transformation of the repeater of the Article List page you create links to the Article Details so that they look like:

<a href="/articleDetails.aspx?articleId=<%# articleId %>"><%# articleName %></a>

(see: https://www.international-adviser.com/CMSHelp/index.html?newedit_transformation_methods.htm)

You can see that I'm appending the article Id onto the url... So that on the articleDetails.aspx page I can pull out that article Id:

- Make a transformation for showing the article details.
- Put a repeater on the article details page that uses that transformation - in the 'where' section put: 'articleId={% articleId %}' to limit the repeater to show a single article.

The {? macro contstruct pulls out the VALUE from the querystring where the key is equal to articlId. Very clever.

You'll need to play with this a bit to get it to work, but good luck,

Lance

User avatar
Member
Member
jwieczorek-pgs-soft - 12/13/2011 8:00:07 AM
   
RE:Kentico mobile pages
It's working well, thx a lot :)