Wednesday, 15 June 2016

CodeIgniter URLs

  • Human friendly
  • Search-engine
  • Standard “query string” approach
  • Dynamic systems
  • Segment-based approach
jayakumar.xyz/codeigniter/docs/urls

URI Segments

It is following MVC Approach
jayakumar.xyz/class/function/ID
  1. The first segment represents the controller class 
  2. The second segment represents the function (method) class
  3. The third segment represents the ids, variable or passing any variables class 
The URI Library and the URL Helper contain functions that make it easy to work with your URI data. In addition, your URLs can be remapped using the URI Routing feature for more flexibility


Removing the index.php file

By default, the index.php file will be included in your URLs:
jayakumar.xyz/index.php/codeigniter/docs/urls
If your Apache server has mod_rewrite enabled, you can easily remove this file by using a .htaccess file with some simple rules.

Example: .htaccess file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

After using .htaccess file default url changed
jayakumar.xyz/codeigniter/docs/urls

Enabling Query Strings

In some cases you might prefer to use query strings URLs:
jayakumar.xyz/index.php?c=products&m=view&id=345
CodeIgniter optionally supports this capability, which can be enabled in your application/config.php file.

$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm'; 
jayakumar.xyz/index.php?c=controller&m=method 

CodeIgniter General Topics

  • CodeIgniter URLs
  • Controllers
  • Reserved Names
  • Views
  • Models
  • Helpers
  • Using CodeIgniter Libraries
  • Creating Libraries
  • Using CodeIgniter Drivers
  • Creating Drivers
  • Creating Core System Classes
  • Creating Ancillary Classes
  • Hooks - Extending the Framework Core
  • Auto-loading Resources
  • Common Functions
  • Compatibility Functions
  • URI Routing
  • Error Handling
  • Caching
  • Profiling Your Application
  • Running via the CLI
  • Managing your Applications
  • Handling Multiple Environments
  • Alternate PHP Syntax for View Files
  • Security
  • PHP Style Guide

Who want Codeigniter?

  • You want a framework with a small footprint.
  • You need exceptional performance.
  • You need broad compatibility with standard hosting accounts that run a variety of PHP versions and configurations.
  • You want a framework that requires nearly zero configuration.
  • You want a framework that does not require you to use the command line.
  • You want a framework that does not require you to adhere to restrictive coding rules.
  • You are not interested in large-scale monolithic libraries like PEAR.
  • You do not want to be forced to learn a templating language (although a template parser is optionally available if you desire one).
  • You eschew complexity, favoring simple solutions.
  • You need clear, thorough documentation.

What is Codeigniter?

CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.

CodeIgniter is an Application Development Framework - a toolkit - for people who build web sites using PHP. Its goal is to enable you to develop projects much faster than you could if you were writing code from scratch, by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries. CodeIgniter lets you creatively focus on your project by minimizing the amount of code needed for a given task.

Git merge branch to another branch

$ git checkout develop $ git pull $ git checkout test-branch $ git merge develop $ git push