Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CakePHP面包屑配置_Php_Cakephp - Fatal编程技术网

CakePHP面包屑配置

CakePHP面包屑配置,php,cakephp,Php,Cakephp,我正在用HtmlHelper为我的CakePHP网站创建面包屑,我需要最后一块面包屑,它不是链接,而是ID。 如果我使用 $this->Html->addCrumb($news['News']['title'],null, array('id' => 'crumbselected')); 我得到我的面包屑,但它是没有html属性的简单文本 如果我添加了一个链接而不是null,那么一切都正常。但正如我所说,我需要的最后一块面包屑不是链接而是ID。只有在输出链接时才使用$opt

我正在用HtmlHelper为我的CakePHP网站创建面包屑,我需要最后一块面包屑,它不是链接,而是ID。 如果我使用

$this->Html->addCrumb($news['News']['title'],null, array('id' => 'crumbselected')); 
我得到我的面包屑,但它是没有html属性的简单文本


如果我添加了一个链接而不是null,那么一切都正常。但正如我所说,我需要的最后一块面包屑不是链接而是ID。

只有在输出链接时才使用
$options
参数。您可以尝试以下方式:

$this->Html->addCrumb('<span id="crumbselected">' . $news['News']['title'] . '</span>',null);
$this->Html->addCrumb(''.$news['news']['title'].',null);