在缓存的视图上不添加面包屑

Gun*_*don 8 php caching cakephp breadcrumbs cakephp-2.3

在我的布局default.ctp我有

<!--nocache-->
  <?php echo $this->Html->getCrumbs(' / ', 'Home'); ?>
<!--/nocache-->
Run Code Online (Sandbox Code Playgroud)

在我称之为rules.cpt的视图中

<!--nocache--><?php $this->Html->addCrumb('Rules', '/rules'); ?><!--/nocache-->
Run Code Online (Sandbox Code Playgroud)

首次打开(未缓存)视图时,面包屑将呈现为希望.每次附加(缓存)渲染时,仅Home显示.

从Controller中删除缓存时

// public $cacheAction = array('home' => 120, 'rules'  => 36000);
Run Code Online (Sandbox Code Playgroud)

一切正常.

为什么不addCrumb()被召唤?我测试添加<?php echo time(); ?>到相同的nocache块工作(即在每个页面渲染时调用).

Gun*_*don 2

问题来源似乎是拨打电话的顺序。

在我的初始版本中,<?php echo $this->Html->getCrumbs(' / ', 'Home'); ?>只要<?php $this->Html->addCrumb('Rules', '/rules'); ?>视图没有被缓存,就可以正常工作。

一旦它们被缓存在之前addCrumb,就只有作品被调用。 getCrumbs

这仅部分回答了我的问题。因为getCrumbs在我的布局中使用,.ctp所以无法更改顺序。

我将此作为答案发布,而不是作为我的问题的注释,以便没有人获得我在问题中已写的内容的赏金;)如果您可以提供剩余问题的解决方案或知道这是否是 Cake 中的错误,我很高兴为您提供赏金。