elephpant/breadcrumb

以简单的方式创建面包屑。该组件简化了为您的网站创建面包屑的方式,以促进更易于访问的导航。它被设计得与Bootstrap框架非常兼容。除了使用简单之外,它还具有非常有趣的可能性,例如添加

2 2021-10-30 00:18 UTC

This package is auto-updated.

Last update: 2024-09-29 05:36:09 UTC


README

Maintainer Source Code PHP from Packagist Latest Version Software License Build Quality Score Total Downloads

以简单的方式创建面包屑。该组件简化了为您的网站创建面包屑的方式,以促进更易于访问的导航。它被设计得与Bootstrap框架非常兼容。除了使用简单之外,它还具有非常有趣的可能性,例如添加新的分隔符和新的CSS类来按您的喜好样式化此界面组件。面包屑组件还允许您访问用于其他系统功能的数组,例如微格式。

以简单的方式创建面包屑。该组件简化了为您的网站创建面包屑的方式,以促进更易于访问的导航。它被设计得与Bootstrap框架非常兼容。除了使用简单之外,它还具有非常有趣的可能性,例如添加新的分隔符和新的CSS类来按您的喜好样式化此界面组件。面包屑组件还允许您访问用于其他系统功能的数组,例如微格式。

亮点

  • 添加其他CSS类(添加其他CSS类)
  • 以数组形式输出(数组输出)
  • 可以添加其他分隔符(可以添加其他链接分隔符)
  • 与Bootstrap框架兼容(与Bootstrap CSS框架兼容)
  • Composer就绪且符合PSR-2规范(准备就绪的Composer和符合PSR-2规范)

安装

通过Composer提供面包屑

"elephpant/breadcrumb": "^1.1"

或者运行

composer require elephpant/breadcrumb

文档

有关使用方法的详细信息,请参阅组件目录中的示例文件夹。其中包含每个类的使用示例。它的工作方式如下

有关使用方法的详细信息,请参阅组件目录中的示例文件夹。其中包含每个类的使用示例。它的工作方式如下

设置网页的所有节点

<?php
require __DIR__ . "/../vendor/autoload.php";

$breadcrumb = (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();

在构造函数方法中更改链接分隔符

<?php
require __DIR__ . "/../vendor/autoload.php";
$separator = "<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: '>>')

选择是否显示主页名称并插入一个图标在该位置

<?php
require __DIR__ . "/../vendor/autoload.php";
$icon = "<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);

在面包屑(链接)中插入一个类

<?php
require __DIR__ . "/../vendor/autoload.php";
$class = "text-underline text-danger";

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

以数组形式输出您的面包屑的所有节点

<?php
require __DIR__ . "/../vendor/autoload.php";

$breadcrumb = (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());

贡献

有关详细信息,请参阅CONTRIBUTING

支持

安全:如果您发现任何与安全相关的问题,请通过sergiodanilojr@hotmail.com发送电子邮件,而不是使用问题跟踪器。

如果您发现任何与安全相关的问题,请通过sergiodanilojr@hotmail.com发送电子邮件,而不是使用问题跟踪器。

谢谢

致谢

许可

MIT许可(MIT)。有关更多信息,请参阅许可文件