Breadcrumbs are not added as caches

in my default.ctp layouts I have

<!--nocache--> <?php echo $this->Html->getCrumbs(' / ', 'Home'); ?> <!--/nocache--> 

Inside a view called rules.cpt I have

 <!--nocache--><?php $this->Html->addCrumb('Rules', '/rules'); ?><!--/nocache--> 

At the first opening (inaccessible) view, breadcrumbs look optional. With each additional (cached) rendering, only Home displayed.

When removing caching from the controller

 // public $cacheAction = array('home' => 120, 'rules' => 36000); 

everything works.

Why isn't addCrumb() called? I tested to add <?php echo time(); ?> <?php echo time(); ?> to the same nocache block that works (i.e. is called on every render page).

+8
php caching cakephp breadcrumbs
source share
1 answer

The source of the problem is the order in which calls are made.

In my initial version <?php echo $this->Html->getCrumbs(' / ', 'Home'); ?> <?php echo $this->Html->getCrumbs(' / ', 'Home'); ?> was called before <?php $this->Html->addCrumb('Rules', '/rules'); ?> <?php $this->Html->addCrumb('Rules', '/rules'); ?> which works fine until the views are cached.

Once they are cached only in addCrumb , it is called before getCrumbs .

This only partially answers my question. Since getCrumbs used in my .ctp layouts, it is not possible to reorder.

I posted this as an answer, and not as a note on my question, so that no one gets generosity for what I already wrote in the question;) If you can provide a solution to the remaining problem or find out if this is a mistake in Cake, I'm glad provide you with generosity.

+2
source share

All Articles