Sitefinity ASP.NET CMS - Content Management System

Support Forum Thread

Home >  Support >  Forums home > Sitefinity 3.x > Suggestions > mobile pc - pda browsing

Reply
Vagelis, 9/28/2007 12:41:38 AM
Hi,

Since many people are using mobile pc or pda while out of office it would be nice sitefinity to optimize for such browsers and displays. I've check both sitefinity.com and telerik.com and the result was not so good in reading. In microsoft.com the blocks of a page are displayed one below the other and it is very readable. Dotnetnuke keeps same structure as running page.

Best regards

Vangelis

Reply
, 9/28/2007 3:49:49 AM
Hello Vagelis,

Thanks a lot for the suggestion. We will definitely put this issue in our TODO list for future releases.

Best wishes,
Pepi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center

Reply
SelArom, 5/13/2008 10:43:41 AM
was any progress ever made with this? I've had some success in just using a different theme and overriding a lot of the css. the only problem I have run into is that I have to change the theme on pre_init which means that I'd have to override the base class from which the pages inherit. I assume you're already doing that so it might complicate things...

what if you gave us an option in the admin, where you normally choose a page theme for a page, and add a second box for "Choose Mobile Theme" so that if a device identifies itself as a mobile device, it will be presented the alternate theme.

Reply
SelArom, 5/14/2008 3:10:10 PM
i was thinking it would probably be a good idea to have an alternate master page template as well, since mobile layouts might need a different overall structure as well as a different theme.

are we able to override or access the pre-init of sitefinity pages to detect for mobile devices and change the theme? I know how to do it in a regular asp.net website, but not sure if it's the same thing in sitefinity.

Reply
SelArom, 5/14/2008 3:41:33 PM
well i found this thread which has a great example of how to change the theme :) i'm guessing this should let me change the master page as well.

this is gonna be fun. i'll report back my experiences


Reply
SelArom, 5/14/2008 4:17:30 PM
totally works! I made the custom class inherited from the telerik base page and overrode the preinit using the wurfl library and BAM my pda loaded the mobile theme (AND the separate mobile.master page) right up while the desktop browser runs the standard theme.

very cool! now i have a few hours of css hacking to do for the new mobile theme...

if anyone's interested here's how I do the check for mobile and theme switch:

using System;  
using System.Data;  
using System.Configuration;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.HtmlControls;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
 
/// <summary>  
/// Summary description for DetectingPage  
/// </summary>  
public class DetectingPage : Telerik.Cms.Web.InternalPage  
{  
    protected override void OnPreInit(EventArgs e)  
    {  
        base.OnPreInit(e);  
 
        bool isMobileDevice;  
        try 
        {  
            wurflApi.deviceFileProcessor proc = new wurflApi.deviceFileProcessor(Server.MapPath("/wurfl.xml"));  
            wurflApi.capabilitiesGetter api = new wurflApi.capabilitiesGetter(ref proc);  
            api.prepareNavigatorModelCapabilities(Request);  
            isMobileDevice = bool.Parse(api.getCapability("is_wireless_device"));  
        }  
        catch 
        {  
            isMobileDevice = Request.Browser.IsMobileDevice;  
        }  
 
        if (isMobileDevice)  
        {  
            Page.Theme = "Mobile";  
            Page.MasterPageFile = "/App_Master/Mobile.master";  
        }  
    }  
}  
 
 

Reply
, 5/15/2008 6:43:37 AM
Hi SelArom,

It's great to hear that you managed to get it to work! We don't have this functionality built-in, but we will reference this scenario to every one else who needs this. By the way, here's the link where we discuss the dynamic change of the themes (the one you have provided is broken).

We would like to thank you for contributing this great tip as well as the wurfl library reference. We have updated your telerik account for that.

Best wishes,
Georgi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center

Reply
Pierre, 5/15/2008 4:22:48 PM
Hi SelArom,

Could you explain more how implement this solution and where?.
Add you this code in your home master page as codebehind?

Very nice job. Thanks.

Regards

Reply
SelArom, 5/15/2008 4:26:33 PM
the code goes in the App_Code/CUSTOM_PAGE.cs where CUSTOM_PAGE is the class file for the page from which you are inheriting the telerik.cms.web.internalpage

create a class and add it to your App_Code folder in the root directory of sitefinity and place that code in there.

then open up ~/sitefinity/cmsentrypoint.aspx and change the Inherits line to match the name of your CUSTOM_PAGE class. now every page that is loaded will inherit from the CUSTOM_PAGE class and execute the OnPreInit command

hope that is helpful!

Reply
Pierre, 5/15/2008 8:04:25 PM
Great work. Could you continue with the next step how to make the page for devices and change the configuration of cmspage based in our devicemodel ppc/phone like the referent website. Regards
Reply
SelArom, 5/15/2008 8:41:18 PM
i'm not quite sure what you mean but I'll try do be as helpful as I can.

you need to define a mobile.master template that is mobile compliant, as well as a theme that will render everything properly. asp.net controls are supposed to render according to the device... you can also use control adapters to modify the output. i haven't got that far yet, so I can't be much help there. google control adapters or also css friendly for more information.

Reply
bnye, 5/24/2008 5:06:36 PM
 if (isMobileDevice && !isIPhone)

JK thanks for great tip.

Reply
Pierre, 5/25/2008 12:29:26 PM
Hi Ben,

Could you complete the tip with complete source for IPhone?. Have you one another sol. to select the handset and changing models?. Regards

Reply
bnye, 5/25/2008 12:43:41 PM
Pierre -

I was just kidding. Pointing out that most (read compliant) Sitefinity sites will look great on the iPhone "as is". But I did a quick google and found this...

Public Shared Function IsIPhoneUser() As Boolean    
    Return HttpContext.Current.Request.UserAgent.ToLower.Contains("iphone")     
End Function  
 
Hope that helps. There is also a Telerik blog post on how different Tererik controls look on the IPhone.

http://blogs.telerik.com/SearchResults.aspx?IndexCatalogue=Blogs&SearchQuery=Iphone

Also, if you want to read a funny review of the IPhone check out this Not Safe For Work:

http://www.thebestpageintheuniverse.net/c.cgi?u=iphone

Sincerely,

bnye