Well I’m sorry, it’s been so long for this part to come.. I had been working very hard on some clients and don’t have enough time to write. Here’s what I had been done if you’re curious :) : http://maps.GpsTrackingIndonesia.com, www.SunberryCorp.com, www.mypushme.com, www.kulacak.com, www.web2trace.com, www.pushmeportal.com, … The fun is almost all of them was written with CodeIgniter :).
Ok, let’s start with the easiest one first. We will create a simple menu page that contains links to other modules on the system. We put it on the Mainpage controller class.
Look at the Mainpage.php controller file. There is a function on it named exactly the same with the filename: Mainpage(). This should be exactly the same including the case. This is the constructor or initialization function of the class. Each time the class is called or instantiate, this function is called automatically. We put some initialization lines inside it:
Read more…
Generate PHP Code
After installing StarUML PHP 5 Code Generator Template , StarUML will have a capability to generate PHP template code based on the models we have defined before. But there’s a little hack to be done so that the naming of the file generated complies with CodeIgniter.
These PHP template code files can be used to simplify our jobs by not typing all class’ attributes and methods that we have done in the UML design and analysis phase.
Read more…
Pagination class is very useful when we are handling a very large set of data. With it, users can see a page of data sets for only 10 or 20 rows and provided with page navigation where user can go to the next and previous page or directly jump to a page number. CodeIgniter has a class for doing this, but we must make a link to the data to be paginated to make it works correctly.
This article show you how to make the link between pagination class and database class to make the pagination works on a table that has a large set of data inside it.
Read more…
This class is used to encode a number of coordinates into an encoded polylines to be used in Google Maps. The code is originally from Jim Hribar http://www.jimhribar.com/cgi-bin/moin.cgi/PolylineEncoder and is rewritten by Gabriel Svennerberg www.svennerberg.com into a class and modified by me into CodeIgniter library. The code is written using the methods and algorithms found in the work of Mark MacClure http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline
Read more…
Passing parameter to a web page build with CodeIgniter (CI) can be done by using either POST variables which comes from HTML form or from the URI. But, different from traditional web application, by default CI only recognizes a segment based URI rather than query string format for passing parameter by URI.
In some circumstances we do need to use the query string to pass data to our page, which in this case using PHP global variable $_GET. By default, CI will not allow us to read the content of $_GET variable but instead using the URI class $this->uri->segment(the_segment_number).
Read more…
In the previous parts of this tutorial series we have discussed how to setup the application environment using XAMPP and CodeIgniter, and the application specification. We have done the analysis and design using UML use case and class diagram with free UML diagram tool StarUML.
In this part, we will discuss the database design for our application. This database is needed to hold the data for our application.
We are going to draw the entity relationship diagram (ERD) using a free tool called MySQL workbench, formerly fabForce ERD tools for MySQL. Before continuing, please download the program here and install it to your computer.
At the end of the designing process, we will create our database structure directly to a MySQL server that can be used by our application.
Read more…
Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program thus making it behave as expected. PHP has an extension that allows us to debug PHP scripts in live manner, called Xdebug. This article explains how to use and configure Xdebug within phpDesigner IDE from MPSOFTWARE. Debugging with Xdebug allows the programmer to analyze, evaluate and find errors in the code line by line.
Read more…
In this part of the tutorial series we will discuss about the application specification. After defining the user requirements we will do the analysis and designing the using UML use cases and class diagram. We are going to use a free UML diagramming tool called StarUML. You can download the program here if you have not installed it in your computer.
Read more…
This tutorial series explain how to develop a web based application using CodeIgniter, the PHP application framework. As you might already know, CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications.
In this tutorial, we took the case of developing a basic web based accounting application that can input cash book and bank book data transaction and journal entry.
The tutorial series will cover:
- Part 1 Setting Up the Environment: XAMPP (apache, mysql, and PHP) and CodeIgniter
- Part 2 The application specification, analysis and design using UML use case and class diagram using free UML diagram tool StarUML.. (download here if you have not install it in your computer) . We also need to install StarUML PHP 5 Code Generator Template to automatically generate the class files from class diagram created
- Part 3 ER Diagram and Creating Database using MySQL workbench, formerly fabForce ERD tools for MySQL
- Part 4, preparing to code in CodeIgniter, exporting class diagram to PHP scripts
- Part 5 Coding, the Mainpage
- Part 6 Coding, the and COA Module explain the application coding using CodeIgniter
- Part 8 Coding, the Cashbook Module explain the application coding using CodeIgniter
- Part 7 Coding, the Bankbook Module explain the application coding using CodeIgniter
- Part 8 Coding, the Journal Module explain the application coding using CodeIgniter
- Part 9 Coding, the Reporting Module explain the application coding using CodeIgniter
- Part 10 Conslusion and Further Development: AJAX, Facebook Application
Read more…
Secara default, database driver MySQL CodeIgniter konek ke port default MySQL yaitu 3306. Pada kondisi dimana port MySQL bukan 3306 misalnya 3307, CodeIgniter tidak punya option untuk menentukan pada port berapa MySQL berjalan.
Solusi untuk hal ini dapat dilakukan dengan beberapa cara:
- mengedit file driver database CodeIgniter: system/database/drivers/mysqli/mysqli_driver.php. Pada file ini dapat ditentukan port MySQL pada function ‘db_connect’ yaitu dengan menambahkan parameter $port pada function tsb:
mysqli_connect ( [string $host [, string $username [, string $passwd [, string $dbname [, int $port [, string $socket]]]]]] )
- mengedit file PHP.INI, pada bagian mysql.default_port, ganti dari 3306 menjadi 3307
- jika tidak punya akses ke file PHP.INI, bisa juga dicoba dengan mengedit file config/database.php nya CodeIgniter yaitu pada baris:
$db['default']['hostname'] = "mysqlhost.yourdomain.com:3307";
Categories: CodeIgniter, MySQL, PHP Tags: CodeIgniter, connect, database, database driver, database drivers, driver database, file, file ini, koneksi, MySQL, PHP, port, string
Recent Comments