Builtin Helper
Helper

Helper is collection of function, Means we can see/create a lot of function in helper file.

In codeigniter there are two type helper.

Built in Helper - Created by CodeIgniter framework, that is located in system/helpers
User define Helper - User can create own helper and save in application/helpers

Builtin Helper

Form Helper
URL Helper
Array Helper
Date Helper
Email Helper
File Helper
HTML Helper
Security Helper
String Helper
Text Helper

How to load Helper

$this->load->helper('form');
$this->load->helper(array('form', 'url'));

we can also load helper by application/config/autoload.php

$autoload['helpers'] = array('database', 'email', 'session');

URL Helper

URL Helper
This function return your site URL, as specified in your
config file. This is will be added index.php in URL

Load Helper-
$this->load->helper('url');

Function -
site_url()
base_url()
current_url()
uri_string()
index_page()
anchor()
mailto()
etc.

base_url()

base_url function return the path of the url
<?php echo base_url(); ?>

uri_string()

To return an URI string

suppose
http://xyz-site.com/topic/id/23

will return topic/id/23


Previous
Next