Get $500+ of the best After Effects files, video templates and music for only $20!
CodeIgniter From Scratch: Day 1
videos

CodeIgniter From Scratch: Day 1

This entry is part 1 of 17 in the CodeIgniter From Scratch Session
Next »

After numerous requests, today we are launching a new screencast series on Nettuts+ that will focus exclusively on the CodeIgniter PHP framework. Over the course of about 10 videos, I’ll teach you exactly how to use this framework. Ultimately, we’ll work our way up to building a custom CMS. Without further ado, here’s day one!

Day 1


Add Comment

Discussion 550 Comments

Comment Page 7 of 8 1 ... 5 6 7 8
  1. ido says:

    thank you so very much! really helpfull.
    i was looking for some good codeigniter from scratch tut till i remembered seeing that, really helped me loads.

    tnx again and keep on the great work

  2. NielsG says:

    My video stops loading after about 85%
    Using FF4 on Mac osx10.6

  3. Kasun says:

    thank you for these nice tutorials,

    I am having difficulties to understand how the OOP works in this MVC – Codeigniter.
    model -> object?
    or do we have to define our own object ?? how to do so?

  4. Shaz says:

    This is awesome. I was experimenting with Symfony yesterday and coding was one thing, the command line was another, configurations itself was giving me a huge headache. While I can say that I have some knowledge of PHP, diving into a framework is serious! Haha…

    Thank you for putting up this video series. It helps A LOT. I love CI!

  5. Jonathan says:

    Hey, just noticed that the class Controller has changed name to CI_Controller.

  6. Julian says:

    Thanks very much for this useful tutorial. It’s very well done!! Congratulations, and thanks again ! ;)

  7. Mike says:

    Not sure whether these comments are still being read but, priceless as this series is, I’ve discovered that the code doesn’t work in CodeIgniter 2.0.2. One change is that the base classes have the prefix CI_ but having corrected this it still doesn’t work.

    Any chance of an update?

    • Mike says:

      As happens so often, I’m talking nonsense. I just forgot to alter the autoload config file, although that has changed quite a bit in 2.0.2. Anyway, it all works fine now.

    • Isabelle says:

      Great video, first step successful :)

  8. Shanimal says:

    Blank page? Model won’t load using $this->load->model(“…”)?

    USE

    class Site extends CI_Controller

    INSTEAD OF class Site extends Controller

    USE

    class Site_model extends CI_Model

    INSTEAD OF class Site_model extends Model

    also

    Its a well adopted standard that classnames are capitalized camel-case (MyClass) and the filenames that represent those classes match the classname exactly (MyClass.php)

    not in codeigniter though.

    I do wonder why such a deviation from a widely adopted standard.

  9. Jeevith says:

    Thanks a lot, really it helped lot :) :)

  10. Serhey says:

    Good tutorial. How I may download it?

  11. Jeff says:

    Doesn’t work, doesn’t work, doesn’t work. Why upload something if it doesn’t work? Soooo glad it’s working for everybody else. Why in every tutorial, every book, and every class I take on anything in web design, am I the only person who ends up not getting their code to work. Every time. Followed the instructions in the video, browsed through the responses, made those adjustments, and just cannot get it to work.

    Not ONLY do I get a blank page even after changing Controller to CI_Controller, I get this as well

    A PHP Error was encountered

    Severity: 8192

    Message: Function set_magic_quotes_runtime() is deprecated

    Filename: codeigniter/CodeIgniter.php

    Line Number: 60
    A PHP Error was encountered

    Severity: Warning

    Message: Cannot modify header information – headers already sent by (output started at /Applications/MAMP/htdocs/ci/system/libraries/Exceptions.php:164)

    Filename: libraries/URI.php

    Line Number: 191
    An Error Was Encountered

    The URI you submitted has disallowed characters.

  12. Dieter says:

    This is really a great tutorial. I just discovered CodeIgniter and I can’t wait to get started with this. I’m looking forward to the rest of the tutorials, and hope my next site can be made with the help of this framework.

  13. Kawohi says:

    Jeffrey,
    I loved the tutorial, But there was some problems that I had to Google to fix. Controller was updated needs to be CI_Controller was the first problem. The other is Model needs to be CI_Model. I am wondering if you can update the post for these changes? I almost just quited until I went back to the user guide and saw the changes. (Maybe put a note like “this is code igniter x.x.x, if your version is newer and something breaks while attempting this tutorial, debug and look back at the user guide” or something like that)

  14. Jeff says:

    Guys, I’m sorry. This tutorial absolutely needs to be redone. Scouring Google to find all the stuff that the has been left out has been an absolute nightmare. I have the right version of PHP, changed Controller to CI_Controller, model to CI_Model, tried it on PHP 5.2 and 5.3, tried it on Mac and PC, turned magic quotes on and off, and went through the tutorial line by line at least 10 times, downloaded the source files and updated them to try to get them to work, and NOTHING.

    I thank Jeffrey for his time he put into the video, and I guess it’s the thought that counts. And I can deal with having to Google how to fix certain errors to get tutorials like these to run, but this is just too much. A video tutorial with an excessive amount of things left out and incorrect needs to be either updated or not posted at all, sorry to say. I will try to find a tutorial on CI that works, and I will let all of you know when I find it.

    • Jeffrey Way says:
      Author

      Things weren’t left out. It’s just that, since it was released, CodeIgniter 2.0 has been released. What specifically isn’t working for you?

    • Noah says:

      Hmm, I think you’re just having bad luck or something. This tutorial worked perfectly for me the first time. I just made the changes to the class names as suggested above and everything worked. I realize you’re frustrated… trust me, I can empathize. However saying that the tutorial needs to be totally redone is a bit much.

      Also, thanks to the author for a great vid!

  15. Grahame says:

    Videos not working. Just a blank screen where it’s supposed to be. Tried in Ubuntu and Mac OS X in safari and chrome. Shame because they look as though they would be really good.

  16. Kevin says:

    Is there ANYTHING that Jeff Way doesn’t know????

  17. Gav says:

    Hi guys – running CodeIgniter 2.0.2 and get the following errors..

    Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set()

    Any ideas?

  18. Chad says:

    I am having a problem with getting this to work. I am using CI 2.0.2

    When I get to the point where you used the tags in the home view to print out the $records variable and get this error from CI:

    A PHP Error was encountered

    Severity: Notice

    Message: Undefined variable: records

    Filename: views/home.php

    Line Number: 12

    This is the code which I have in my home view:

    My View has been loaded

    This is the code I have in my controller site.php file:

    load->model(‘site_model’);
    $data['records'] = $this->site_model->getAll();
    $this->load->view(‘home’);
    }

    }

    Finally this is the code I have within my model site_model.php:

    load->model(‘site_model’);
    $data['records'] = $this->site_model->getAll();
    $this->load->view(‘home’);
    }

    }

    Thanks for your great tut. I am not sure if its something I did or its something from the new version of CI.

    • Chad says:

      Sorry I forgot to replace my with &l t ; and $r t ;

      I am having a problem with getting this to work. I am using CI 2.0.2

      When I get to the point where you used the < pre &rt; tags in the home view to print out the $records variable and get this error from CI:

      A PHP Error was encountered

      Severity: Notice

      Message: Undefined variable: records

      Filename: views/home.php

      Line Number: 12

      This is the code which I have in my home view:

      <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
      “http://www.w3.org/TR/html4/loose.dtd”&rt;
      <html&rt;
      <head&rt;
      <title&rt;</title&rt;
      </head&rt;
      <body&rt;
      <div id=”container”&rt;
      <p&rt;My View has been loaded</p&rt;

      <pre&rt;
      <?php print_r($records);?&rt;
      </pre&rt;
      </div&rt;
      </body&rt;
      </html&rt;

      This is the code I have in my controller site.php file:

      <?php

      class Site extends CI_Controller {

      function index(){
      $this-&rt;load-&rt;model(‘site_model’);
      $data['records'] = $this-&rt;site_model-&rt;getAll();
      $this-&rt;load-&rt;view(‘home’);
      }

      }

      Finally this is the code I have within my model site_model.php:

      <?php

      class Site extends CI_Controller {

      function index(){
      $this-&rt;load-&rt;model(‘site_model’);
      $data['records'] = $this-&rt;site_model-&rt;getAll();
      $this-&rt;load-&rt;view(‘home’);
      }

      }

      Thanks for your great tut. I am not sure if its something I did or its something from the new version of CI.

      • Todd says:

        You have to send model data with view to be loaded, so:

        $this->load->view(‘home’, $data);

        then in your view you can access them

  19. Eric says:

    Jeffrey great tutorial. I am just getting started with CodeIgnighter and your tutorial is amazing!

  20. basitjee says:

    Thanks in advance

  21. basitjee says:

    Wow, I just watch the tutorial. ooo man this is amazing. Wow

  22. mydream19 says:

    finally i found this tutorial easy to understand than cakephp bake..thanks very much

  23. Alex says:

    The video stops loading. I did not see 100% tutorials. Please do the fixing.

  24. Camille says:

    Yehey! After several hours of debugging, I solved the issue. I just disabled error logging in PHP. Thanks a lot Jeffrey!! I love your tutorials!! Thanks!

  25. Tintin says:

    Thanks! Was really helpful!

  26. Manish Kumar says:

    This Video is really Nice………..Its very helpful
    Thank you So much

  27. Jerry Lee says:

    I am running into a problem with my site_model. When I load localhost, it is giving me errors about
    Fatal error: Class ‘model’ not found in C:\wamp\www\ci\application\models\site_model.php on line 3
    which is

    class Site_model extends model {
    function getAll() {
    			$q = $this->db->get('test');
    
    			if($q->num_rows() > 0) {
    			foreach ($q->result() as $row)
    			{
    				$data[] = $row;
    			}
    			return $data;
    			}
    		}
    
    	}
    

    Any ideas? I am using WAMP

  28. Ronan says:

    Amazing tutorial!! Thank you so much!

  29. Greg says:

    Lol I was screaming at the screen when you were going back and forth over the misnamed $this->load->model…haha

    But aside from that moment of laughter it was a great intro to codeigniter.
    I’ve been working as a junior developer for the last few months and needed a refresher with more fundamental knowledge of a MVC framework. I will be watching a couple a day. Good stuff!

  30. dinesh bhattacharjee says:

    hi frnd this tutorial helped me a lot and very perfect understanding video………. my hearty thanks to u
    my frnd… plz give me some advance buidling of shopping cart to build with the help of codeigniter
    thankyou…………..very much

  31. Tom says:

    Cool tut series, tnx!!

  32. Freddy says:

    Grate tutorial, everything is working for me, what about building simple blog with cms that you were talking about here, you didn’t continue with that so far?

  33. Daniel Lucas says:

    Nice tutorial. I was just looking into this for the sake of learning a new framework.
    I’m using CodeIgniter 2.2 and a few things have changed such as Controller has become CI_Controller.
    The explanations in this tut are great ;)

  34. Anil Kumar says:

    Very Nice tutorial who are new to Code Igniter…Thanks for sharing it…

  35. Samar says:

    I had a awesome start up to code ignitor with this video. A big thanks goes for Jeffrey !

  36. Jake says:

    Anyone following this tutorial and encountering errors it’s because you are using a newer version of CodeIgniter, just do the following:

    1. When creating a new controller class it’s not “extends Controller” but “extends CI_Controller”
    2. When creating a new model class it’s not “extends Model” but “extends CI_Model”

  37. John says:

    Great Tutorial… I just loved it!!!!!!!!!

  38. Victor says:

    Hi, thank you for this awesome tutorial!

    I got a problem though, after I made all the settings in autoload, config and route and get this error message:
    __________________________
    A Database Error Occurred

    Unable to connect to your database server using the provided settings.

    Filename: C:\wamp\www\ci\system\database\DB_driver.php

    Line Number: 124
    ___________________________

    The line number only shows where the error message is thrown from -_-, I´m using version 2.0.3, any ideas?

    Thanks in advance!

    • Victor says:

      Sorry guys, I just had to alter the database.php file. In case of anyone else having the same issue:
      (and you are using *AMP)

      $db['default']['username'] = ”;

      to

      $db['default']['username'] = ‘root’;

      My bad.

      • BG says:

        I get a similar error, but tried the fix mentioned above. Any suggestions?

        A Database Error Occurred

        Unable to connect to your database server using the provided settings.

        Filename: C:\xampp\htdocs\CI\system\database\DB_driver.php

        Line Number: 124

  39. Christian says:

    In the model, why do you need to loop through and assign the values of $q to $data instead of just returning $q?

  40. DK-Donthamsetti says:

    Thanks a lot!!!!!!!!!!!

  41. Aman Arora says:

    I was just not able to resist to commen to your post Jeff, Your video tutorials are just awesome. Previously I watched whole series of your creating wordpress theme, it was really easy to follow and today I started watching this and again you are awesome man, this one is also really easy to understand. I can say you are awesome whole day heheheheh

  42. Aman Arora says:

    when I tried to run the code i.e when I went to localhost/ci/index.php/site I got an error fatal error class controller not found. Any help would be greatful :)

  43. Ulises says:

    I noticed that for the new version of CI, it is necessary to extend the controllers and models with the prefix ‘CI’ otherwise the examples provided in this video will not work. It took me a while to figure this out and i was testing in the wrong places. So you should add:

    class Site_model extends CI_Model

    instead of:
    class Site_model extends Model

    Thanks for the tutorial though, it is a great way to start with this amazing framework.

  44. mike c says:

    Aweson, man , thank you for this.

  45. Great tutorial! Only one problem:

    I had to add the following code to the beginning of the site_model to make the CI functions to work:

    function __construct()
    {
    // Call the Model constructor
    parent::__construct();
    }

    My friend who knows more about php and CI suggested that I add this code.

    Now why did the example in the video work without this code?

  46. Daemorog says:

    Very nice i finally beginning to understand MVC i realy had trouble with undestanding that pattern.

    Btw how do you swap database eg if you need two database to work in to get info and how do you send email by using ci

    And how do you eg run multiple website on it

    i guess using a other controller but that can get kinda crowded fast

  47. sushant says:

    when i m runing helloworld.php i got this error

    404 Page Not Found

    The page you requested was not found.

    what i do please tell me

  48. Ahmed Akhtar says:

    Really nice tutorial …. loved it.

  49. BG says:

    I had trouble on the first video with the “extends CI_Controller” issue, but was able to resolve it within five minutes by reading these posts. Thanks to everyone for posting. At first glance, this video series seems way to good to waste. With that being said, I would recommend posting an errata page to list all the changes and updates. I’m still on video one, but plan on moving forward with the series. My ultimate goal is to learn about the Zend Framework, since I’m having Magento sites, but I thought this would be a good next step.

Comment Page 7 of 8 1 ... 5 6 7 8

Add a Comment

To add a code snippet to your comment, please wrap your code like so: <pre name="code" class="html">YOUR CODE</pre>. You can replace the class name with "js," "css," "sql," or "php." If there are any "<" or ">" within your code, please search and replace them with: &lt; and &gt; respectively.