Seeking advice re basic switching templates

dishyzee
14 years, 2 months ago
Hi Barnabas,

Those links really helped a lot . But while Tera-WURFL provides much more detail than I'd ever realised existed about device detection, I'm not sure if I got the answer I was looking for. I simply wanted to know which user-agent I could expect to work with which MJ template. Are these mappings correct?

mobile_imode => 'Mozilla/4.0',
mobile_iphone => '4.0.1 iPhone 4 Apple-iPhone3C1/801.306',
mobile_pda => 'Mozilla/4.76 [en] (PalmOS; U; WebPro/3.0; Palm-Arz1)',
mobile_wap => 'SCH-A950+UP.Browser/6.2.3.2+(GUI)+MMP/2.0'

It would be really handy to see some screen grabs that show how the templates render each sample user-agent. Do these exist somewhere?

(I take your point about UA switching not replacing real testing.)

Thanks again,
DishyZee
Barnabas
14 years, 1 month ago
Hi Dishyzee,
I'll try to answer the questions as stated and then try to answer what I think might be the question behind the question.

I put each of the 4 strings above into the user agent switcher and viewed the site.
The results were that
mobile_imode => 'Mozilla/4.0', triggered the pda template.
mobile_iphone => '4.0.1 iPhone 4 Apple-iPhone3C1/801.306', triggered the iphone template.
mobile_pda => 'Mozilla/4.76 [en] (PalmOS; U; WebPro/3.0; Palm-Arz1)', did not trigger a mobile template; it showed desk top template instead.
mobile_wap => 'SCH-A950+UP.Browser/6.2.3.2+(GUI)+MMP/2.0' triggered pda template, same as first one.

What I think you were asking was, "What do I have to put into the user agent switcher so I can see all the templates on my site?". (If you were asking "How will my site look for this particular phone?", then I still haven't answered the question.)

The way that MJ detects mobiles changed between 0.9.7 and 0.9.8 so I have only had a quick look to see how it is done in 0.9.8 Essentially the plugin named "Mobile Joomla Plugin", when enabled, tries to decide if the site is being viewed by a mobile browser. It uses at least two techniques; a fast and a slower one. The fast one looks for unique text in the http string. The slower one is used when the first is inconclusive and accesses the Terra-wurfl database to identify the string and uses preferred markup field. It also keeps a record of browsers that have accessed the site and looks in there before the whole database.

So, by looking at the code used by the plugin it is possible to code some very brief user agent strings which will force MJ to use a certain template.

In Firefox, one of the drop down options in user agent switcher is edit user agents, and on that option is an option for a new user agent. When you get that screen delete everything so you have 8 blank rows.
Copy in 2 of the lines from below and click OK. You will need to do this 4 times. I'm sure you'll get the hang of it. Comment#6 above explains how to use the user agent switcher.

Description: Force iphone
User Agent: Mozilla/5.0 (iPhone;

Description: Force WAP wml
User Agent: WAP-Browser

Description: Force xhtml
User Agent: blackberry

Description: Force imode
User Agent: LG-C3100

Remember that it's possible to get your site to show each of the templates by using the
Components > K Mobile Joomla > Settings > Global Settings > General settings > Domain multisite support (yes)

You asked for screenshots. I can only offer the site I look after, which is on 0.9.6 because I edited some of the templates before I learned how to do it properly. (Copy and rename the template so MJ doesn't replace it when upgrading). I moved the menus to the bottom of the screen in some cases and also turned off the pictures for the WAP view. Both of these changes were done using parameters in the modules. I also added the Mobile Joomla link to the desktop view by hacking code. (www.mobilejoomla.com/forum/topic.html?id=466 but this may not work in 0.9.
The site is www.boynhillbaptist.org.uk, you can also view it as iphone.boynhillbaptist.org.uk pda.boynhillbaptist.org.uk imode.boynhillbaptist.org.uk wap.boynhillbaptist.org.uk

Force iphone showing top of screen

Force iphone showing bottom of screen


Force imode showing top of screen

Force imode showing bottom of screen


Force wap showing top of screen

Force wap showing bottom of screen


Force xhtml showing top of screen

Force xhtml showing bottom of screen


Desktop showing top of screen (pictures on left are automatically refreshed, screenshot shows two overlaid)

Desktop showing bottom of screen
2

By continuing to use this site you consent to the use of cookies on your device as described in our cookie policy unless you have disabled them. This site will not function correctly without cookies.

I accept cookies from this site.