承接 jinnguyen/puja-breadcrumb 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jinnguyen/puja-breadcrumb

Composer 安装命令:

composer require jinnguyen/puja-breadcrumb

包简介

Puja-Breadcrumb is a simple class to manage the breadcrumbs

README 文档

README

Puja-Breadcrumb is a simple class to manage the breadcrumbs

Installation

Just run this on the command line:

composer require jinnguyen/puja-breadcrumb

Usage

include '/path/to/vendor/autoload.php';
use Puja\Breadcrumb\Breadcrumb;

Examples:

Simple

$breadcrumb = new Breadcrumb;
$breadcrumb->add('Subpage 2', '/subpage2');
echo $breadcrumb->render();

new breadcrumb with a array

$breadcrumb = new Breadcrumb(array(
    array('title' => 'Home', 'link' => '/'),
    array('title' => 'Page', 'link' => '/page'),
    array('title' => 'Subpage', 'link' => '/subpage/?a=5&b[]=7&b[]=8'),
));
$breadcrumb->add('Subpage 2', '/subpage2');
echo $breadcrumb->render();

The rest of the documentation will assume you have a $breadcrumb instance on which you are making calls.

Adding a crumb

$breadcrumb->add('Home', '/');

Delete all crumb

$breadcrumb->deleteAll();

Delete last crumb

$breadcrumb->deleteLastItem();

Count breadcrumb elements

$breadcrumb->count();

Check empty

$breadcrumb->isEmpty(); // same with $breadcrumb->count() == 0

Get data:

$breadcrumb->getData(); // get all breadcrumb nodes

First and Last CSS classes

    
  • Home
  • // First Breadcrumb element
  • Page
  • Subpage
  • Subpage 2
  • // Last Breadcrumb Element

The first/last css classes are the class of first/last Breadcrumb element

$breadcrumb->setFirstCssClassName($className);
$breadcrumb->setLastCssClassName($className);

The Element

The default breadcrumb element is <li class="{FirstLastCss}">%s{Divider}</li>. To change it, use the setElement method like so:

$breadcrumb->setElement('<span class="{FirstLastCss}">%s{Divider}</span>');

Note:

"%s" is required for Breadcrumb::$element
{FirstLastCss}: will be replaced by Breadcrumb::$firstCssClassName for first element and Breadcrumb::$lastCssClassName for last element
{Divider}: will be replaced by Breadcrumb::$divider

The List Element

The default list element used to wrap the breadcrumbs, is <ul>%s</ul>. To change it, use the setListElement method like so:

$breadcrumbs->setListElement('<ol class="ol-breadcrumb">%s</ol>');

Note:

"%s" is required for Breadcrumb::$listElement

Divider

The default breadcrumb divider is `` (empty). This will be replace to placeholder {Divider} in property Breadcrumb::$element. If you'd like to change it to, for example, /, you can just do:

$breadcrumb->setDivider('/');

Output

Finally, when you actually want to display your breadcrumbs, all you need to do is call the render() method on the instance:

echo $breadcrumb->render();

Note that by default crumb titles are rendered with escaping HTML characters, if you'd like to ignore it just do like so:

$breadcrumb->setSafeHtml(false);

统计信息

  • 总下载量: 39
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache
  • 更新时间: 2017-01-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固