CodeIgniter 2 Cookbook


CodeIgniter 2 Cookbook
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
$23.99
save 20%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
$49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Customizable code that can be used in your own applications right away
  • Recipes that will help you solve your Codeigniter issues efficiently and effectively
  • Each recipe comes with a full code example, and where necessary, the Model and View files are included too

Book Details

Language : English
Paperback : 306 pages [ 235mm x 191mm ]
Release Date : December 2013
ISBN : 1782162305
ISBN 13 : 9781782162308
Author(s) : Rob Foster
Topics and Technologies : All Books, Application Development, Open Source

Table of Contents

Preface
Chapter 1: CodeIgniter Basics
Chapter 2: User Management
Chapter 3: Creating E-commerce Features
Chapter 4: Email, HTML Table, and Text Libraries
Chapter 5: Managing Data In and Out
Chapter 6: Working with Databases
Chapter 7: Creating a Secure User Environment
Chapter 8: Calendaring, Right Place, and Right Time
Chapter 9: Extending the Core
Chapter 10: Working with Images
Chapter 11: SEO, Caching, and Logging
Index
  • Chapter 1: CodeIgniter Basics
    • Introduction
    • Downloading and installing CodeIgniter
    • Basic configuration options
    • Managing CodeIgniter on different environments
    • Managing database settings on different environments
    • Securing the system files
    • Removing index.php from the address bar using .htaccess
    • Installing and using Sparks
    • Chapter 2: User Management
      • Introduction
      • Viewing users
      • Creating users
      • Editing users
      • Deleting users
      • Generating passwords with CodeIgniter
      • Generating passwords with CodeIgniter – the bare bones
      • Forgot password? – resetting passwords with CodeIgniter
      • Chapter 3: Creating E-commerce Features
        • Introduction
        • Amending configuration settings to run sessions in a database
        • Creating a basic cart
        • Adding and searching by product categories
        • Saving the cart to the database
        • Chapter 4: Email, HTML Table, and Text Libraries
          • Introduction
          • Sending plain e-mails with CodeIgniter Email
          • Sending HTML e-mails with CodeIgniter Email
          • Sending attachments with CodeIgniter Email
          • Sending bulk e-mails with CodeIgniter Email
          • Using an HTML table with DataTable
          • Using an HTML table with DataTable and a database
          • Using word_limiter() for table output
          • Using word_censor() for cleaning input
          • Chapter 5: Managing Data In and Out
            • Introduction
            • Sending different data to multiple views
            • Validating user input
            • Preparing user input
            • Sticky form elements in CodeIgniter
            • Displaying errors next to form items
            • Reading files from the filesystem
            • Writing files to the filesystem
            • Creating and downloading ZIP files
            • Uploading files with CodeIgniter
            • Creating and using validation callbacks
            • Using the language class
            • Confirming cookie acceptance from the user
            • Chapter 6: Working with Databases
              • Introduction
              • Configuring CodeIgniter for databases
              • Connecting to multiple databases
              • Active Record – create (insert)
              • Active Record – read (select)
              • Active Record – update
              • ActiveRecord – delete
              • Looping through the database results
              • Counting the number of returned results with num_rows()
              • Counting the number of returned results with count_all_results()
              • Query binding
              • Finding the last insert id
              • Finding the number of affected rows
              • Finding the last database query
              • Using CodeIgniter database migrations
              • Moving to the current version with current()
              • Rolling back/stepping forward with version()
              • Generating an XML from a database result
              • Generating a CSV from a database result
                • Chapter 8: Calendaring, Right Place, and Right Time
                  • Introduction
                  • Building a CodeIgniter Calendar helper with database results
                  • Building an appointment manager with Calendar Library
                  • Creating a helper to work with a person's date of birth
                  • Working with fuzzy dates in CodeIgniter
                  • Chapter 9: Extending the Core
                    • Introduction
                    • Using CodeIgniter Sparks
                    • Creating PDFs with the DOMPDF Spark
                    • Creating Hooks in CodeIgniter
                    • Clearing dead sessions from the database
                    • Extending your controllers
                    • Uploading a file with FTP
                    • Creating libraries and giving them access to CodeIgniter resources
                    • Making your own configuration files and using the settings
                    • Using the language class – switching language on the go
                    • Chapter 10: Working with Images
                      • Introduction
                      • Installing ImageMagick on MAC with Cactuslab
                      • Uploading images with CodeIgniter
                      • Generating thumbnails – resizing
                      • Rotating images
                      • Cropping images
                      • Adding watermarks with text
                      • Adding watermarks with image overlays
                      • Submitting a form with CodeIgniter CAPTCHA

                        Rob Foster

                        Rob Foster has been working in web development for almost 10 years, mainly focusing on the LAMP stack (although currently rocking a Mac). He has been developing with CodeIgniter for over 3 years, and he has worked in IT for various sectors such as public health, charity, news media, and even for the gaming industry.
                        Sorry, we don't have any reviews for this title yet.

                        Code Downloads

                        Download the code and support files for this book.


                        Submit Errata

                        Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                        Errata

                        - 26 submitted: last submission 14 Mar 2014

                        Errata Type: Grammar | Page No.: 5

                        "...because it not only involve a strong..." should be "...because it not only involves a strong..."

                         

                         

                        Errata Type: Grammar | Page No.: 30

                        "A the form is being submitted rather than..." should be "As the form is being submitted rather than..."

                        Errata Type: Grammar | Page No.: 42

                        “$this->encrypt->sha1($text_to_be_hashed, $key) will return a string that we'll store in the variable, $hash.” should be "“$this->encrypt->sha1($text_to_be_hashed, $key) will return a string that we'll store in the $hash variable.”

                        Errata Type: Technical | Page No.: 13

                        "“If you are using a MAC or Linux, then the command line interface is open to you.” should be "“If you are using a Mac or Linux, then the command line interface is open to you.”

                        Errata Type: Layout | Page No.: 31

                        "You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit h"  should be "You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/supportand register to have the files e-mailed directly to you."

                        Errata Type: Grammar | Page No.: 42

                        "$this->encrypt->sha1 ($text_to_be_hashed) will return a string that we'll store in the, $hash variable." should be "$this->encrypt->sha1 ($text_to_be_hashed) will return a string that we'll store in the $hash variable."

                        Errata Type: Typo | Page No.: 23

                        “...and our error delimiters are set with the function, set_error_deimiters().” should be “...and our error delimiters are set with the function, set_error_delimiters().”

                        Errata Type: Grammar | Page No.: 2

                        "But, having no experience with CodeIgniter shouldn't be a road block to read the book either.” should be "But, having no experience with CodeIgniter shouldn't be a roadblock to reading the book either.”

                        Errata Type: Grammar | Page No.: 11

                        "...on which system you are using,..."  should be "...on which operating system you are using,..."

                        Errata Type: Grammar | Page No.: 2

                        “An *AMP environment (LAMP, MAMP, WAMP, and so on)”  should be  "A *AMP environment (LAMP, MAMP, WAMP, and so on)”

                        Errata Type: Grammar | Page No.: 7

                         

                        "...having to edit or maintain each time they are moved." - should be "...having to edit or maintain them each time they are moved."

                        Errata Type: Grammar | Page No.: 21

                        "...and will need to; manually enter their data..." should be "...and will need to manually enter their data..."

                         

                         

                        Errata Type: Grammar | Page No.: 42

                        "...is passed to the sha1 function in the encrypt library, storing its product in the, $hash variable.”  should be  "...is passed to the sha1 function in the encrypt library, storing its product in the $hash variable.”

                         

                        Errata Type: Grammar | Page No.: 5

                         "...but also gives the coder the ability to express himself in order to ensure a smooth flow, making codeshould be  "...but also gives the coder the ability to express himself to ensure a smooth flow while making code."

                        Errata Type: Grammar | Page No.: 2

                        "...immediate sold snippets..." should be "...immediate solid snippets..."

                        Errata Type: Grammar | Page No.: 31

                         

                        “But I'm aware that you won't necessarily need all the following files, the lines which focus on password hashing in the following examples.”  should be  “But I'm aware that you won't necessarily need all the following files and the lines which focus on password hashing, which are given in the following examples."

                        Errata Type: Technical | Page No.: 23

                        "In this case, the code will load the, cust/new_user view."  should be   "In this case, the code will load the users/new_user view."

                        Errata Type: Technical | Page No.: 24

                         

                        “The $data array is then sent to the Users_model for writing to the database using the syntax: $this->Users_model->get_all_users().”   should be  "The $data array is then sent to the 

                        Users_model for writing to the database using the syntax: $this->Users_model->process_create_user($data)."

                        Errata Type: Code | Page No.: 26

                         

                        'is_active' => $this->input->post('is_active'),"     should be  'is_active' => $this->input->post('is_active')"

                        Errata Type: Technical | Page No.: 13

                        “Useful installations for CodeIgniter...”  should be "Useful extensions and libraries for CodeIgniter..."

                        Errata Type: Technical | Page No.: 42

                         

                        “If they do not match, we send redirect() to the login screen, but you could easily code any action, such as logging the event or displaying a message rather than a redirect.”  should be  “If they do not match, we redirect() to the login screen, but you could easily code any action, such as logging the event or displaying a message rather than a redirect.”

                        Errata Type: Technical | Page No.: 32

                         

                        "For instructions on how to do that, see” should be removed. 

                        Errata Type: Technical | Page No.: 18

                        The Item name column should have the following  the content: id, first_name, last_name, email, created_date, and is_active.

                        And the Attributes value of is_active should be varchar(3).

                        Errata Type: Technical | Page No.: 106

                         "$config['global_xrsf_filtering']" should be "$config['global_xss_filtering']"

                        Errata Type: Code | Page No.: 104

                        "$this->form_validation->set_rules('item1',
                        'Item1', 'matches
                        [users.username]');"

                        should be

                        "$this->form_validation->set_rules('item1',
                        'Item1', 'is_unique
                        [users.username]');"

                        Errata Type: Code | Page No.: 26

                        "'value' => set_value('is_active', $is_active)" should be "'checked' => set_value('is_active', $is_active)"

                         

                        Sample chapters

                        You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                        Frequently bought together

                        CodeIgniter 2 Cookbook +    Citrix® XenApp® 6.5 Expert Cookbook =
                        50% Off
                        the second eBook
                        Price for both: ₨712.80

                        Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                        What you will learn from this book

                        • Build simple yet powerful PHP and CodeIgniter applications
                        • Create e-commerce features to add to your application
                        • Manipulate images – crop, rotate, and add watermarks
                        • Secure your user environment
                        • Provide a forgot password functionality to users
                        • Optimize your SEO and search capabilities
                        • Manage money flow in your application
                        • Work with the EU Cookie Law (confirming Cookies from the user)
                        • Use database migrations to roll back changes and advance to newer database versions

                        In Detail

                        As a developer, there are going to be times when you’ll need a quick and easy solution to a coding problem. CodeIgniter is a powerful open source PHP framework which allows you to build simple yet powerful full-feature web applications.

                        CodeIgniter 2 Cookbook will give you quick access to practical recipes and useful code snippets which you can add directly into your CodeIgniter application to get the job done. It contains over 80 ready-to-use recipes that you can quickly refer to within your CodeIgniter application or project.

                        This book is your complete guide to creating fully functioning PHP web applications, full of easy-to-follow recipes that will aid you in any aspect of developing with CodeIgniter. CodeIgniter 2 Cookbook takes you from the basics of CodeIgniter, through e-commerce features for your applications, and ends by helping you ensure that your environment is secure for your users and SEO friendly to draw in customers.

                        Starting with installation and setup, CodeIgniter 2 Cookbook provides quick solutions to programming problems that you can directly include in your own projects. You will be moving through databases, EU Cookie Law, caching, and everything else in-between with useful, ready-to-go recipes. You will look at image manipulation using the Image Manipulation library, user management (building a simple CRUD interface), switching languages on the fly according to the user preference, caching content to reduce server load, and much more.

                        Approach

                        Presented in a recipe-based format, you are led step-by-step through each aspect of CodeIgniter, allowing you to dip in and out as you choose.

                        Who this book is for

                        CodeIgniter 2 Cookbook is for intermediate to advanced PHP developers who want to begin using the powerful CodeIgniter framework to create web applications. Familiarity with CodeIgniter isn’t essential, but it will be useful if you have been introduced to the framework before.

                        Code Download and Errata
                        Packt Anytime, Anywhere
                        Register Books
                        Print Upgrades
                        eBook Downloads
                        Video Support
                        Contact Us
                        Awards Voting Nominations Previous Winners
                        Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                        Resources
                        Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software