CodeIgniter From Scratch: Day 4
videos

CodeIgniter From Scratch: Day 4 – Newsletter Signup

This entry is part 4 of 17 in the CodeIgniter From Scratch Session
« PreviousNext »

Continuing on from Day 3, we’ll expand our little application into a simple newsletter signup form. This will allow us to taker a closer look at both the email and the form_validation classes. Learn it all in this 30 minute screencast.

Catch Up

Day 4

If you’re having trouble viewing the video, watch it here instead.


Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • Joseph Wilson

    I spent most of yesterday refreshing my browser…waiting for the next installment in the series! *blushes*

    Thanks, Jeffrey, for continuing the series. (And no, I haven’t watched this video yet. ;) )

    • http://www.freshclickmedia.com Shane

      Me too – thanks for continuing the series Jeffrey!

      • http://www.jeff-way.com Jeffrey Way
        Author

        Thanks, guys!

    • Joseph Wilson

      Okay…just finished it! “Fully awesome!” :D

  • Mohsen

    Watching the tut…
    thanks

  • ibura

    thank you jeff, i am building my knowledge base only from you.

  • Johan

    Nice! Just one little thing:

    Did’nt you say in the first video that you would walk the “readers” thru writing an CMS? We are already in video 4 of 10 and it’s still very basic stuff going on (only fetching from database). To me the email-class seems like it should be coming a little further down the line…

    The quality is very good though, and I hope you’ll continue with the series.

    • http://www.jeff-way.com Jeffrey Way
      Author

      I can’t begin teaching how to build a CMS until I’ve taught the basics.

      • http://www.jeff-way.com Jeffrey Way
        Author

        Keep in mind that this series is for beginners who have no experience working with the MVC pattern. It takes time… :)

  • http://www.freshclickmedia.com Shane

    That email label’s for attribute references the name input incorrectly. Sorry to be a pedant! :)

    Good stuff Jeffrey!

    • http://www.jeff-way.com Jeffrey Way
      Author

      The label references the id of the input.

      • http://www.freshclickmedia.com Shane

        Yeah – I know what the ‘for’ attribute is um… for :)

        Your second label’s ‘for’ attribute associates it with the first input (the name input.)

        The second label’s for attribute should have a value of email.

      • http://www.jeff-way.com Jeffrey Way
        Author

        Oh, hehe. I guess that ruins the entire tutorial then. :)

      • http://www.freshclickmedia.com Shane

        I’m sure we can let you off, just this once ;)

        (And I did apologise :) )

  • http://eyoosuf.blogspot.com Yoosuf

    gonna watch, should be a nice one as usual :)

  • http://www.newarts.at Drazen Mokic

    Well done Jeffrey!

    Just a little thing, you did not xss_clean the input fields ‘name’ and ‘email’, maybe you are using global xss cleaning? I think especially beginners should learn to use this every time they work with user input.

    Apart from that, thanks for the tutorial, great work!!!

    • http://www.jeff-way.com Jeffrey Way
      Author

      Did I not mention turing on global xss cleaning in the video? I thought I did. If not, we’ll go over that in Day 5.

  • Chad Hietala

    Keep them coming Jeffery! All of these screencasts allows me to get a better grasp of the MVC pattern.

  • asdoaw

    Jeffrey why dont you just press cmd+tab instead of using this silly window explorer

    • http://www.jeff-way.com Jeffrey Way
      Author

      Because I don’t.

      • Lee

        Its much more Swoooooshy to do it like that, don’t you agree? :) Great tut Jeff, look forward to the rest!

  • http://www.schultzstudio.com Chris

    Yes! Chicken enchiladas and CodeIgniter. It’s a great day! Thanks Jeffrey!

  • http://www.jlapitan.com jlapitan

    thanks jeff, i just started from Day1.. hehe.. i would like to teach this on my class also, im using your video tutorials about “jquery for absolute beginners” for my class now..

    is there a way i can download your complete video tutorials about jquery?

    Thanks!

    • http://www.jeff-way.com Jeffrey Way
      Author

      Go to iTunes and search for “Nettuts.” They should come up for download.

  • http://www.zacvineyard.com Zac

    I think updating a database should be included in the next tut. These are great videos! Thank you!.

  • http://www.destinomultimedia.com DaViDz

    Awesome, thanks from Spain :)

    • http://blog.davidrojas.net David Rojas

      Another David from Spain here ;-)

      • Carlos

        +1 from Madrid, Spain.

  • http://jonpiehl.com Jon Piehl

    Question 1:
    Is there a difference between the config you created (system_root) and the url helper (base_url)? If so, can you please explain.

    Question 2:
    I’m new to MVC so I was wondering why the $name_data array is set in the view instead of the controller and then passed to the view. The real question is when should variables be set in the controller and when should they be set in the view?

    Thanks. These tuts are amazing!

  • Kevin

    If you would write a big website, how do you keep things organized? Do you use subfolders for your views/controllers?

    • http://www.newarts.at Drazen Mokic

      Yes, if you have i.e. a site with an admin backend then you should use subfolders.

      f.e.

      -views
      -welcome.php
      -register.php
      –admin
      —index.php
      —module1.php
      —module2.php

      • harton

        How to you call controllers in subfolders?

        thx. :-)

      • http://www.newarts.at Drazen Mokic

        Controllers are called over the URL…

        domain.com/subfolder/controller …

      • http://www.teleportz.com.ar Santiago Dimattía

        @harton

        Simply use:
        $this->load->view(‘folder/file’);

        Note that you can only use one subfolder. If you use 2 or more, it will fail.

      • http://www.teleportz.com.ar Santiago Dimattía

        Ups, i think i’m tired.
        Ignore my previous comment!

    • http://leenug.com Lee

      I follow the convention of putting all my views in a folder named after the controller, so:
      BLOG
      -Index
      -Comments
      – Etc
      ADMIN
      – Index
      – Users

      And call them like:
      $this->load->view(‘blog/index’);

      Just my method, but keeps things nice and organised!

  • George

    Hey guys, I am just waiting for the tutorial to load and I am going to watch it later, great series by the way.
    Can I ask if you would consider offering us a download link to the video file as well?

    • http://blog.davidrojas.net David Rojas

      You can download all nettuts videos in iTunes (search NETTUTS), or from blip.tv (in 2 qualities). This video is here: http://nettuts.blip.tv/file/2466799/

  • harton

    Hi Jeff,

    great tut. :-)

    One questions though:
    Can you also use “return;” at a method in case you want to abort its action?

    Considering your next tut:
    It would be cool if you can show a tut that passes variables from the view into the controller up to the model and back.

    thanks for your great work :-)
    cheers
    harton

  • Greg McAusland

    Loving this series, keep em coming!

  • http://vasili.duove.com/ Vasili

    Though I don’t use CI (or any framework for that matter), I still enjoy watching these screencasts. I thought it was funny at first when you were typing the rules and didn’t have them as strings. I was thinking to myself that PHP would parse them as constants, which it did.

    However, my favorite part has got to be the jQuery reference. This is why I love your videos, Jeffrey. They are always funny even if you don’t mean to make them. :P

  • http://www.brianswebdesign.com Brian Temecula

    CI evangelism at its finest.

  • Chris Brown

    Another great tutorial in this series. I’ve really been taking away a lot from each video and even read ‘CodeIgniter for Rapid PHP Application Development’ in 3 days after following the first tutorial.

    This is definitely one of the best video tutorial series to date from Nettuts…maybe even going to be better than the jQuery series. Thanks for the knowledge share!

  • Cecily

    I was following along just fine until about 22 minutes in. In the tutorial when you pressed the Submit button to send the empty form, the page reloaded with error messages displaying. When I tried it on my setup, I got a 404 not found error. I’m not exactly sure why, as the send function is included in my email.php controller file. Do you know what might be causing this error?

    • Cecily

      Never mind – I figured it out. It had to do with the configuration of my base_url, although I don’t know why it worked fine in episode 3 but not episode 4.

      • http://www.jeff-way.com Jeffrey Way
        Author

        My guess is that you forgot to rename the base_url within the config file to day4 (instead of day3)??

  • Johnathan

    Hey Jeff, was wondering if you could maybe keep the names of each video the same like Codeigniter: Day x or w/e I have to keep changing them so they get added to my smart playlist in iTunes. Would make it look a whole lot more organised.
    But apart from that they’re great.
    Thanks :)

  • http://marocweb.av.ma kamal

    Hi Jeffrey Way,

    Thank you for this tuto.

    I search a tutorial of MVC symfony framworks,

    Can you post a tutorial about this MVC

    Thanks again

  • Domino

    For anyone trying to make the download files work, the following needs to be changed:

    1. Go to the routes.php in the application>config folder. Change the default controller from ‘site’ to ‘email’.

    Mr. Way, the index function in your ‘site’ controller is missing a semi-colon and the closing curly brace.

  • Danijel

    Just watched it. It’s great. :) Wondering when Part 5 is out?

    • http://www.jeff-way.com Jeffrey Way
      Author

      Around next Tuesday.

      • Danijel

        Can’t wait :D

  • http://sonergonul.com Soner Gönül

    That’s great! Thanks :)

  • Arnold

    Thanks! Jeffrey…I think this is better than Day 3..because you’ve taught lots of good stuff right there…

    In day 5…
    how about we use some more sessions ?or use some javascript library like jQuery

    I cant wait really for day 5..
    yay!

  • Jim

    Nice one. I might be jumping the gun here, but it would be cool to see a tutorial or two on using some of the third-party libraries (http://codeigniter.com/wiki/Libraries):

    - IgnitedRecord for ORM
    - Tank Auth for Authentication
    - Modular Extensions for HMVC

    Something along those lines. I’d also really like to see a tutorial for creating an admin area, but I understand you need to teach the fundamentals first. Either way, keep the CI tuts coming!

  • MEM

    Those are very nice tutorials.

    CodeIgniter should know about this and put a big link here. Very nice stuff. I’m absolutely new on frameworks, I have played a little with OOP so those tutorials feets like a charm.

    I will however, not follow a path of lets use nice features BUT, lets learn more about basic features. Once we have the basic, we can move on on more complicated stuff.

    For example: Build a menu, a pagination, working with joins… this kind of stuff, it’s the basic, but will allow us to properly develop.

    Regards,
    MEM

  • jeanv

    great ! Thanks ! Keep on Jeffrey you’re doing a good job !

  • rosnovski

    Jeff,

    Nice screencast. I am glad you still are doing this. I wanted to know if you would be doing one with jquery used to do ajax and all the fun stuff you taught us with the jquery screencasts? anyways love all the screencasts so far and here’s to more good stuff. Keep it up sir!

  • http://www.benoitvilliere.com benoa

    Sweet! Thank you JW :^)

  • http://hyperbear.be Bjørn endre

    Great screencasts, Jeff! I didn’t know about CI before you started with these tutorials. I’m definitely going to use the framework in my current and future web projects.

    A couple of things though; Could you provide a list with planned screencasts, like what topics and when you are going to cover them? And also, could you please bump secure login (with salts and sha1, user levels, the whole pack) up on that list? ;)

    I’m really looking forward to the next screencast, keep ‘em coming!

  • Javed Gardezi

    Great series please continue on..
    can not wait for next one… JW

  • http://ronny-andre.no Ronny-André Bendiksen

    Jeffrey, is there a reason on why you’re not using shorthand PHP on the form_open() ?

  • timo.huber

    thanks again.
    i’ve learned a lot :)

  • http://www.zarpio.co.nr Khalil

    Dear Jeffrey Way,

    I am learning from your posts these are very good for new students like me… Please share a post for Login Form with Validation on CI Framework.

  • Gonzalo

    Thanks for the tutorial, Jeff. Any chance you share with us your Dreamweaver Coloring Scheme? It’s a dark one with brown tones… you used it here: http://net.tutsplus.com/videos/screencasts/easy-development-with-codeigniter/

    It’s an XML file (Colors.xml) in Documents and Settings\<user\Application Data\Adobe\Dreamweaver CS4\en_US\Configuration\CodeColoring

    Thanks in advance :)

  • Zach

    Jeffrey,

    Loving these videos. Constantly refreshing my iTunes podcasts window in the middle of the week to check for updates to the series.

    Please please please keep up the good work.

    Thanks so much.

  • bluepicaso

    hello people i want to thank Jeffry Way, elliot and the tuts plus team for there screencasts here…..
    I was a newbie to CI and this week I will be launching my first ever project(a travel site) totally based on codeigniter…
    I’m just loving it… Thanx people…

    follow me on twitter http://www.twitter.com/bluepicaso

  • Kevin

    Hey jeffrey,

    The last 3 tutorials were great. But this one doesn’t seem to work for me :(
    It just shows the loading animation, even though the whole thing has finished loading. I’ve tried it in several different browsers.

    Can you put up a download link of the video? It just doesn’t seem to work for me.

    Anyways, the last 3 were great. Thanks alot. Keep up the good work!

  • http://www.ideasfactory.lt Vaidotas

    Where is day 5? :( Cann’t wait :(

    • http://www.jeff-way.com Jeffrey Way
      Author

      Definitely Thursday, or Friday!

      • Guillermo Carrion

        Great! Can’t wait! :-)

  • Ryan

    Can’t wait for day 5!!!

  • Ben

    Dude your killing me whens the next one!!

    Waiting…..

    Loving them obviously!!!

  • http://acrespo.mediajux.com Alvin Crespo

    Purely amazing. I did not know that code igniter comes with such a powerful form validation class. This is awesome, thank you so much for taking the time to explain this to us. I feel like I have a good grasp on this framework now, with all that you have taught us in just 4 screencasts. The 5th one is next, cant wait!

  • patience

    Video won’t play. Been trying for 2 days now.

    • http://www.jeff-way.com Jeffrey Way
      Author

      How strange. I just added a link below the video where you can watch it directly at Blip.tv.

  • http://www.pequenotux.blogspot.com Wilson

    Thanks from Brazil!
    I’m learning so much!
    I love you man!

  • Chaky

    Thanks for Hong Kong
    I loving you….you re the bst

  • Isabela

    The day 3 and 4 of this series had a very good timing in my project.Thanks Jeff.You’re doing a great job