easier to read and update (improving team work and maintainability). It will help you to give large websites a coherent structure. It will discipline your code and make it more robust, in some cases even without your knowing it.
That's quite a big claim. You have already spent some time learning PHP, HTML, CSS, a database, and so on. You need basic, not necessarily expert knowledge of PHP to benefit from CI.
CI doesn't take long to learn, and it quickly pays for your effort in the time saved later. Let's look at a simple measure how CI reduces the amount of code you need to type. This is not just good for the lazy. The less you type, the fewer mistakes you make, and the less time you spend debugging your code.
Let's take two examples, (they are explained later in this book, so don't worry now about how they work!). If you are writing a database query, this is how you might write a function within your PHP program to query a MySQL database:
$connection = mysql_connect("localhost","fred","12345");By using CodeIgniter, you just need to do this :
mysql_select_db("websites", $connection);
$result = mysql_query ("SELECT * FROM sites", $connection);
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
foreach ($row as $attribute)
print "{$attribute[1]}";
}
$this->load->database('websites');
$query = $this->db->get('sites');
foreach ($query->result() as $row)
{
print $row->url;
}
Pretty simple, isn't it ? :D
Okay, that's for today.... I'll write another articles
Tidak ada komentar:
Posting Komentar