Skip to main content
deleted 2 characters in body
Source Link
Keyul Shah
  • 7.2k
  • 13
  • 38
  • 60

I have a block that displays a random review in the footer. But when the BLOCK_HTML cache is active it is cached and does not display a random review.

I added the block in the theme local.xml:

<?xml version="1.0"?>
<layout version="0.1.0">
  <default>
    <!-- other stuff-->
    <reference name="footer">
      <!-- other stuff-->
      <block type="core/template" template="custom/random-review.phtml" name="random_review">
        <action method="setCacheLifetime"><s>null</s></action>
        <!-- <action method="setCacheLifetime"><s>0</s></action> I tried both, and I know the diffrence -->
      </block>
      <!-- other stuff-->
    </reference>
    <!-- other stuff-->
  </default>
  <!-- other stuff-->
</layout>

The template itself is mostly irrelevant to this question But I tried this in /template/custom/random-review.phtml:

<?php
echo rand (0,10000);
// the real template that fetches the random review.

It is called in /template/page/html/footer.phtml:

<!-- other footer stuff -->
<?php echo $this->getChildHtml('random_review') ?>
<?php //echo $this->getChildHtml('random_review', false)  // Also doesn't work ?>
<!-- other footer stuff -->

What am I missing here? Why is this block being cached?

I have a block that displays a random review in the footer. But when the BLOCK_HTML cache is active it is cached and does not display a random review.

I added the block in the theme local.xml:

<?xml version="1.0"?>
<layout version="0.1.0">
  <default>
    <!-- other stuff-->
    <reference name="footer">
      <!-- other stuff-->
      <block type="core/template" template="custom/random-review.phtml" name="random_review">
        <action method="setCacheLifetime"><s>null</s></action>
        <!-- <action method="setCacheLifetime"><s>0</s></action> I tried both, and I know the diffrence -->
      </block>
      <!-- other stuff-->
    </reference>
    <!-- other stuff-->
  </default>
  <!-- other stuff-->
</layout>

The template itself is mostly irrelevant to this question But I tried this in /template/custom/random-review.phtml:

<?php
echo rand (0,10000);
// the real template that fetches the random review.

It is called in /template/page/html/footer.phtml:

<!-- other footer stuff -->
<?php echo $this->getChildHtml('random_review') ?>
<?php //echo $this->getChildHtml('random_review', false)  // Also doesn't work ?>
<!-- other footer stuff -->

What am I missing here? Why is this block being cached?

I have a block that displays a random review in the footer. But when the BLOCK_HTML cache is active it is cached and does not display a random review.

I added the block in the theme local.xml:

<?xml version="1.0"?>
<layout version="0.1.0">
  <default>
    <!-- other stuff-->
    <reference name="footer">
      <!-- other stuff-->
      <block type="core/template" template="custom/random-review.phtml" name="random_review">
        <action method="setCacheLifetime"><s>null</s></action>
        <!-- <action method="setCacheLifetime"><s>0</s></action> I tried both, and I know the diffrence -->
      </block>
      <!-- other stuff-->
    </reference>
    <!-- other stuff-->
  </default>
  <!-- other stuff-->
</layout>

The template itself is mostly irrelevant to this question But I tried this in /template/custom/random-review.phtml:

<?php
echo rand (0,10000);
// the real template that fetches the random review.

It is called in /template/page/html/footer.phtml:

<!-- other footer stuff -->
<?php echo $this->getChildHtml('random_review') ?>
<?php //echo $this->getChildHtml('random_review', false)  // Also doesn't work ?>
<!-- other footer stuff -->

What am I missing here? Why is this block being cached?

Source Link
janw
  • 980
  • 3
  • 9
  • 21

Block beeing cached despite excluding it

I have a block that displays a random review in the footer. But when the BLOCK_HTML cache is active it is cached and does not display a random review.

I added the block in the theme local.xml:

<?xml version="1.0"?>
<layout version="0.1.0">
  <default>
    <!-- other stuff-->
    <reference name="footer">
      <!-- other stuff-->
      <block type="core/template" template="custom/random-review.phtml" name="random_review">
        <action method="setCacheLifetime"><s>null</s></action>
        <!-- <action method="setCacheLifetime"><s>0</s></action> I tried both, and I know the diffrence -->
      </block>
      <!-- other stuff-->
    </reference>
    <!-- other stuff-->
  </default>
  <!-- other stuff-->
</layout>

The template itself is mostly irrelevant to this question But I tried this in /template/custom/random-review.phtml:

<?php
echo rand (0,10000);
// the real template that fetches the random review.

It is called in /template/page/html/footer.phtml:

<!-- other footer stuff -->
<?php echo $this->getChildHtml('random_review') ?>
<?php //echo $this->getChildHtml('random_review', false)  // Also doesn't work ?>
<!-- other footer stuff -->

What am I missing here? Why is this block being cached?