Subscribe to
Posts
Comments
NSLog(); Header Image

WP-Cache 2.0.17 Dynamic Capability Broken?

WP-Cache purports to support the ability to publish certain things dynamically (like my rotating header images), yet this functionality seems broken in version 2.0.17.

From the WP-Cache site:

<!--mclude file.php-->
<?php include_once(ABSPATH . 'file.php'); ?>
<!--/mclude-->


My own code (header_rotator.inc file):
function get_random_header_image()
{
    $header_imgs[] = 'arnold_fuzzy';
    $header_imgs[] = 'augustine';
    :
    return $header_imgs[rand(0, count($header_imgs)-1)];
}

<div id="headerimage">
    <img src="/wp-content/themes/nslog/img/headers/<?=get_random_header_image();?>.jpg" height="189" width="760" alt="NSLog(); Header Image" />
</div>

header.php file:
<!-- mclude header_rotator.inc -->
<? include('header_rotator.inc'); ?>
<!-- /mclude -->

Result? The same image shows up constantly.

5 Responses to "WP-Cache 2.0.17 Dynamic Capability Broken?"

  1. Note: reloading works fine on this page because "wp-" is included in the URL.

  2. Maybe your module is output cached?

  3. I'm an idiot. Of course your module is being output cached -- that's what you were saying.

    Looking at the source of this module and its preg's, I believe you need to remove the space between "--" and "mclude". So your include should be:

    <!--mclude header_rotator.inc-->

    <!--/mclude-->

    See line 132 to 141 of wp-cache-phase2.php of WP-Cache.

  4. WP needs comment preview capability.

    What I tried to say was that you have a space after the XML comment but before the word "mclude". That needs to be removed for WP-Cache's regular expressions to work properly.

  5. I think I've got it working now. It required me to specify more of an absolute path to the script, even though the actual include was fine:

    <!--mclude /wp-content/themes/nslog/header_rotator.inc-->
    <? include('header_rotator.inc'); ?>
    <!--/mclude-->

    The removal of the spaces helped as well. Thank you, EJ, for pointing that out.

    P.S. WP has comment preview capability, I believe, at least as far as a Live Preview goes. That's just a little JS/HTML. I'll see if I can get that wired up, even though it's not the traditional style.

    P.P.S. I also need to figure out how to remove WordPress's auto-formatting. Our double dashes were changed to em dashes. 🙁


Trackback URI | Comments RSS

Leave a Reply

Please abide by the comment policy. Valid HTML includes: <blockquote><p>, <em>, <strong>, <ul>, <ol>, and <a href>. Please use the "Quote Me" functionality to quote comments.