Don't understand CI

#1
[eluser]Unknown[/eluser]
I've looked over the information about how this works etc.

Is this like a javascript library? such as jquery?

Do I just include a file? The installation instructions said put the index.php in your root dir, which means I wouldnt be able to use index.php as the first page people see when they load the website?

Obviously I'm pretty ignorant when it comes to this, but I know enough php/mysql to create databases input/retrieve information, some sessions, using forms etc..

Is there a easier understanding to this framwork? I'm not seeing how its easier than regular php.

#2
[eluser]Michael Wales[/eluser]
In the past you have developed your PHP applications like this:

Code:
<?php
// index.php
$connection = @mysql_connect('localhost', 'root', '');
$db = @mysql_select_db('myapp');

$sql = 'SELECT * FROM users';
$result = @mysql_query($sql);
?>
<html>
  <head>
    <title>My Site</title>
  </head>
  <body>
    <table>
&lt;?php
  foreach ($row = mysql_fetch_assoc($result)) {
    echo '<tr><td>' . $row['username'] . '</td><td>' . $row['created_on'] . '</td></tr>';
  }
?&gt;
    </table>
  &lt;/body&gt;
&lt;/html&gt;

This is pretty much bad - your data access and manipulation, your content, design - it's all mixed into one horrible, unmaintanable, mess.

CodeIgniter is an MVC (Model-View-Controller) framework. Where we take a 3-tiered approach to development - I highly recommend Googling MVC, there are thousands of resources as it is a proven method of all sorts of software development. Basically, we seperate our application out - all of the data in one place, our HTML pages in another, and the hardcore processing stuff in a third.

Additionally, CodeIgniter offers a lot of valuable bits and pieces of code for your to use. The ActiveRecord library, for instance is very popular. Not only does it simplify the syntax when working with a database but it allows you to switch from MySQL, to MS SQL, to PostgreSQL, and beyond with little to no modification of your own code.

Things like generating random strings, working with dates and time, validating user input, handling sessions - these are all things you don't have to worry about anymore.

Check out the User Guide, screencasts, Wiki and this forum - there's a lot of information around to get you started.

Welcome to the community!

#3
[eluser]Developer13[/eluser]
With CodeIgniter, index.php becomes your "front controller". I would highly recommend watching the blog video tutorials and reading the user manual.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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