If I use renderDynamic twice in the view, there is a strange problem

Using the page cache, and I’ve used renderDynamic twice in the view, as follows:

the 1st

<div id="post-list">

        <?php $this->renderDynamic('renderPartial', '_postlist_dynamic', array(), true); ?>


the 2nd

<div id="sidebar">

        <?php $this->renderDynamic('renderPartial', '_tags', array(), true); ?>


In the ‘_postlist_dynamic’ view and ‘_tag’ view, I’ve used fragment cache. take the ‘_tag’ view as example

<?php if($this->beginCache('tb-tagCloud', array('duration'=>3600))) { ?>

        <?php $this->widget('TagCloud', array(


        )); ?>

<?php $this->endCache();} ?>

Now the problems are:

  1. Everything works when the page first opened(the cache is cleaned), but the next time, there is a very strange problem, the contents which should be displayed in the 2nd place is now displayed in the 1st renderDynamic, and the 2nd place now showed <###dynamic-1###> instead.

  2. If remove any renderDynamic, retaining only one other, everything works.

How to fixed it?

just use different cache id like tb-tagCloud_tags and tb-tagCloud_postlist_dynamic or what ever you want in

<?php if($this->beginCache('tb-tagCloud', array('duration'=>3600))) { ?>

This is solved in the trunk (Yii 1.1.5)…