PHP code example of geeklabs / ci4-breadcrumbs

1. Go to this page and download the library: Download geeklabs/ci4-breadcrumbs library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

geeklabs / ci4-breadcrumbs example snippets


 $this->breadcrumb->add('Home', '/');
 $this->breadcrumb->add('Dashboard', '/dashboard');  
 $this->breadcrumb->add('Customers', '/customers');  

 namespace App\Controllers;

use CodeIgniter\Controller;
use App\Modules\Breadcrumbs\Breadcrumbs;

class Home extends Controller{

    public $breadcrumb;

    public function __construct()
    {        
        $this->breadcrumb = new Breadcrumb();
    }

    public function index(){

        $this->breadcrumb->add('Home', '/');
        $this->breadcrumb->add('Dashboard', '/dashboard');
        $this->breadcrumb->add('Customer', '/dashboard/customer');

        $data['breadcrumbs'] = $this->breadcrumb->render();

        return view('home', $data);

    }

}

php spark breadcrumbs:publish

$data['breadcrumbs'] = $this->breadcrumb->buildAuto();

  echo $breadcrumbs; 

 $data['breadcrumbs'] = $this->breadcrumb->render();
 

  echo $breadcrumbs;