• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

#2
[eluser]Ki[/eluser]
thats great.... but where are the files?

#3
[eluser]tetranet[/eluser]
The files are in google SVN here http://code.google.com/p/cimobile/source...pplication
This weekend i will make available another version with the configuration in config directory and another method in the library to check the IMEI code.

#4
[eluser]Ki[/eluser]
I do not see any files there... Looking forward to the update

#5
[eluser]tetranet[/eluser]
You need to click on cimobile --username tetranetweb -> application -> controllers and libraries. Thats it the files show up in the right side. To make things easier the structure of directory follow the same of CodeIgniter.

#6
[eluser]tetranet[/eluser]
Ci mobile was updated. Two new things:

1 - mobi.php inside config folder ( now all configuration and customization of the library can be done in this file).

2 - is_valid_imei method (This method is useful for people who works with mobile devices and need to validate the IMEI number).

the use of the method is simple:

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’) );



if( $this->cimobile->is_valid_imei(‘VALID IMEI NUMBER’) )
{
echo "IMEI number is valid";
}
else
{
echo "IMEI number is invalid";
}


}
}

#7
[eluser]Ki[/eluser]
Can you please double check your links. Nothing happens when I click on cimobile --username tetranetweb

#8
[eluser]tetranet[/eluser]
It is there = ) but to make things more easy here is a direct link for the latest version http://www.tetranet.com.br/download/cimobile.rar

Always the lastest version will be available in this link also = ) and for contribution etc will be in google SVN.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.