I'm desperately looking for a PHP 5 framework that will work best to develop .mobi sites.
One major feature that it should contain is browser recognition for different handsets, so that the site will work properly on all types of phones?
I'm desperately looking for a PHP 5 framework that will work best to develop .mobi sites.
One major feature that it should contain is browser recognition for different handsets, so that the site will work properly on all types of phones?
Mobile browsers, like desktop browsers, all have their own problems and "special needs" so it would be a good idea to include a check to see what browser you are outputting to, because it could affect the output greatly.
I haven't heard of a PHP Framework that specializes on mobile clients. If I were you I wouldn't try to find a specialized Framework but just define your needs in general and see which framework can cover them best. The recognition of the different clients can be easily integrated into any existing framework.
Codeigniter has a class called User Agent.
However you may have to create your own class for mobile browsers.
The User Agent Class provides functions that help identify information about the browser, mobile device, or robot visiting your site. In addition you can get referrer information as well as language and supported character-set information.
Example: When the User Agent class is initialized it will attempt to determine whether the user agent browsing your site is a web browser, a mobile device, or a robot. It will also gather the platform information if it is available.
$this->load->library('user_agent');
if ($this->agent->is_browser())
{
$agent = $this->agent->browser().' '.$this->agent->version();
}
elseif ($this->agent->is_robot())
{
$agent = $this->agent->robot();
}
elseif ($this->agent->is_mobile())
{
$agent = $this->agent->mobile();
}
else
{
$agent = 'Unidentified User Agent';
}
echo $agent;
echo $this->agent->platform(); // Platform info (Windows, Linux, Mac, etc.)
CakePHP, as part of the built-in RequestHandler component, checks the User Agent string against a big list of known devices and can therefore automatically display different content to those clients.
Here's the list it compares against:
iPhone, MIDP, AvantGo, BlackBerry, J2ME, Opera Mini, DoCoMo, NetFront, Nokia, PalmOS, PalmSource, portalmmm, Plucker, ReqwirelessWeb, SonyEricsson, Symbian, UP.Browser, Windows CE, Xiino
Even you don't go with CakePHP, you can take a look at the source of that file to see more about how it handles those requests.