Welcome Guest, Not a member yet? Register   Sign In
CiMobile - A library for CodeIgniter aimed to give support for mobile devices
#1

[eluser]tetranet[/eluser]
Hello, I'm here with humility to share a small library the I developed based on Alex King plugin for WordPress. I want to share this library to help PHP programmers to develop their websites and/or systems and also to receive feedbacks, improvements and so on. The CiMobile library enables the PHP developer optimize websites for mobile devices giving an easy way to identify browsers, store user preferences and switch from mobile to desktop version of the website. The use is simple and I think it can be useful.

The use of the library is easy, it needs to upload 2 files, the first one (mobiredirect.php) is a small controller which the aim is to redirect pages when the mobile/desktop version is forced to run. The second file (cimobile.php) is the library itself. The two files are below the application directory, mobiredirect.php goes in controller folder and cimobile.php goes in library folder. After the upload, its done to be used, below thers a small example of usage:

Code:
class Mycontroller extends Controller
{
function __construct()
{
parent::Controller();
}

function index()
{
//Loading CiMobile library with the argument 'AUTO' which is the
//default. For all pages of the website let the 'AUTO' setted to
//indentify naturally the browser and platform. The other two options
//are reject_mobile/force_mobile aimed to force a determined version
//of the website to run.
$this->load->library(‘cimobile’, array(‘browser_type’ => ‘AUTO’) );

//Checking if the mobile version will be loaded or not.
if( $this->cimobile->check_mobile() )
{
//--Loading the template for the mobile version of the website--

//Shows the link to desktop version of the website.
//If no argument is passed the default phrase is loaded.
echo $this->cimobile->desktop_link(‘Vai para a versão para o computador’);

}
else
{
//--Loading the template for the desktop version of the site--

//Shows a link for the mobile version of the website.
//If no argument is passed the default phrase is loaded.
echo $this->cimobile->mobile_link(‘Vai para a versão móvel’);

}

}
}

That's it, the library is small but seems to work smoothly, lots of other things can be added with the feedback and help of other CiDevelopers.

The link of the SVN is in google code here: SVN CiMobile


Messages In This Thread
CiMobile - A library for CodeIgniter aimed to give support for mobile devices - by El Forum - 12-14-2009, 09:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB