Breadcrumb for Codeigniter
Lightweight Codeigniter library for generating HTML breadcrumb
A library that is very easy to understand and use was one of our major considerations while writing this library. In that sense, using this simple library has no pain to face ranging from adding and update of config file, to loading of the library and usage.
Follow the steps below to setup this library in your project:
- Copy the
breadcrumb.phpfile in the config folder and paste in
application/configfolder in your project
- Copy and paste the
Breadcrumb.phpfile in the libraries folder to the
application/librariesfolder of your project
- Load the library into your project by adding the piece of code below to the controller set for it
Codeigniter allows you to autoload libraries, configs etc, so you can also autoload this library by adding
breadcrumb to your libraries array in the
config/autoload.php file of your project
- To generate breadcrumb, call the
add()method to add crumb and the
show()method to output the breadcrumb as shown below
$this->breadcrumb->add('Home', '/'); $this->breadcrumb->add('Pages', '/pages'); $this->breadcrumb->add('About', '/pages/about'); $this->breadcrumb->show();
The about code will generate the html code below
<div class="breadcrumb"> <a href="/">Home</a> > <a href="/pages">Pages</a> > <a href="/pages/about">About</a> </div>
You can also configure the library via the
breadcrumb.php file in the
application/config folder. This file allows you to set crumb divider, crumb opening and closing tag, breadcrumb opening and closing tag and crumb for your index page which is usually the homepage
Issues and Contribution
This is an open source project, feel free to create issues, submit pull requests to make corrections, enhance functionality etc
How can you support me?
That's very easy. Just use the library in your projects, help me share with other and of course, star the repository.
You can also follow me on twitter @iamuchejude. Thank you.
MIT © Uche Jude