Extension talk:MagicNoCache/Archive

Hi there! Great extension. I was wondering, is it possible to call somehow fix it to work through a template? Right now if I try to use __NOCACHE__ on a template it doesn't work. Instead, it just shows the text "__NOCACHE__". Is there a way around this? Thank you!

Acook 17:23, 10 December 2007 (UTC)

Part Solution
Hello,

I thought I fixed your problem but this is what I know so far...

It seems the text is checked before the template is processed, so only magic words on the main page is detected and not in the template. I used a different hook that will read the page after the templates has been processed.

So instead of using

use

then modify the function at the end too

The problem is that because everything has already been processed it is too late to disable the cache :(

I hope that helps. Feel free to fix, amend or improve my solution!


 * Awesome! That seemed to fix it.  Thanks for all of the help!  Acook 21:07, 10 December 2007 (UTC)

Undefined variable: action, on line 67 FIX
If you run PHP with out global variables on, you get the "Undefined variable" error.

In the function checkForMagicWord add $action to global: function checkForMagicWord(&$parser, &$text, &$strip_state) { global $wgOut, $action; $mw = MagicWord::get('MAG_NOCACHE'); #woohoo! we do! - now remove the word from the text if (!in_array($action, array('edit', 'submit')) && $mw->matchAndRemove($text)) { $parser->disableCache; $wgOut->enableClientCache(false); }   return true; } /Ubernissen 22:33, 13 February 2008 (UTC)

What about work on 1.12.0?
subj.