PHP code example of elephpant / breadcrumb

1. Go to this page and download the library: Download elephpant/breadcrumb 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/ */

    

elephpant / breadcrumb example snippets



adcrumb = (new \ElePHPant\Breadcrumb\Breadcrumb(null))
    ->base("https://www.sergiodanilojr.com.br", "Home")
    ->addCrumb("Blog", "blog")
    ->addCrumb("Nome do Artigo", "url-do-artigo")
    ->addCrumb("Comentários", "comments");

//In Your webpage you can show the breadcrum, like that
echo $breadcrumb->render();


rator = "<i class='icon-angle-right'></i>";

$breadcrumb = (new \ElePHPant\Breadcrumb\Breadcrumb($separator));

//NOTEs:
// The default value of the separator is null. But the Bootstrap use with the 'content' attribute the slash ("/") like a separator 
// The separator's of string type, therefore you can set html or just a character (example: '>>')



 = "<i class='icon-home'></i>";

$breadcrumb = (new \ElePHPant\Breadcrumb\Breadcrumb(null));
$breadcrumb->base("https://elephpant.com.br", "Home",false, $icon);
//NOTE: The third param's is false for hide the name (Home)

//If you want to put another class insert value in the 5th param:
$class = "p-3 rounded";
$breadcrumb->base("https://elephpant.com.br", "Home",false, $icon, $class);



s = "text-underline text-danger";

$breadcrumb = (new \ElePHPant\Breadcrumb\Breadcrumb(null));
$breadcrumb->base("https://elephpant.com.br", "Home",false, $icon)
->addCrumb("Blog", "blog", $class);



adcrumb = (new \ElePHPant\Breadcrumb\Breadcrumb(null))
    ->base("https://www.sergiodanilojr.com.br", "Home")
    ->addCrumb("Blog", "blog")
    ->addCrumb("Nome do Artigo", "url-do-artigo")
    ->addCrumb("Comentários", "comments");

print_r($breadcrumb->allCrumbs());