Hi
folks out there, Dheeraj here with a complete new series of coding course on Intelligent computing. During these time i was proceeding on programming
and with as you know, programmers are too lazy to write same code again, i
solved problem by creating few function that helped me to reduce development
and coding time straight by 30%.
If
you are PHP Developer and using Codeigniter and is in Codeigniter development, great with MVC architecture
of PHP development, luckily you got awesome information over here. I would like
you to introduce "Helper Model" (that’s what it does for me) and
today i am going to tell you how to integrate in your codeigniter application.
1. Download Helper_model
First
of all, visitGithub to view and download helper_model.php file.
You
may download it or may get the text and create new local PHP file named
Helper_model.php and save it.
2. Setup Helper Model on codeigniter 3.x
Once
you get the fresh copy of Helper_model.php, save it inside your models folder
of your Application directory in codeigniter.
to
make it easily available in all of your application, lets just autoload this.
·
Open
your application/config/autoload.php
·
in
autoload helper section, probably at last line of file,
·
add
this helper_model and make snynoms what you like.
for
example
$autoload['model'] =
array(array('Helper_model'=>'lib'));
|
What
this will do is, load helper model in all of your application automatically and
let you use by having to write "lib" instead of Helper_model. You can
specify any small alias you wish.
3. Start using Helper model
You
can start using helper model just by calling function in it as
$this->lib->function_name('your_arg');
For
example,
If
you want to fetch table and its data, you would simply use
$table = $this->lib->get_table('table_name');
|
Data
from table will be fetched and returned in $table variable if number of rows
retuned is greater than 0. In next few post, will be explaining use of each
function of helper model, and i bet you'll be saving lots of your time. If you
understand helper model and wants to share with us or wants to further develop,
fork my code and ad your functions to it. Share this post with your programmer
friends and be first to like/follow us on facebook and twitter.
Have
great time.
No comments :
Post a Comment