[pmwiki-devel] Disabling a recipe on one page only.

John Rankin john.rankin at affinity.co.nz
Tue Jun 9 17:07:29 CDT 2009


On Wednesday, 10 June 2009 8:24 AM, Patrick R. Michaud <pmichaud at pobox.com> wrote:
>On Wed, Jun 10, 2009 at 06:54:41AM +1200, Simon wrote:
>> I have a recipe that is an improved version of the original one -
>> defined in config.php (include_once etc)
>> (http://kiwiwiki.co.nz/pmwiki/pmwiki.php/Test/ProtectEmail)
>> I want to run the original on one page only (include once in
>> Groupname.PageName.php),
>> (http://kiwiwiki.co.nz/pmwiki/pmwiki.php/Test/ProtectEmailOriginal), -
>> but there must be
>> How do I 'uninclude'  for that specific page
>
>There's not a way to 'uninclude' -- PmWiki's approach here
>has always been that it's better to not include in the first
>place rather than try to undo the effects of an include.
>
>So, in local/Test.ProtectEmailOriginal.php, load the original
>recipe, and set a flag variable saying it's been loaded.
>
>In local/Test.php, load the improved variable only if the
>flag variable from Test.ProtectEmailOriginal.php hasn't
>been set.
>
>(It's for _exactly_ this situation that per-page customizations
>are processed before the per-group customizations.)
>
>Pm
>
If you need to load the improved version site-wide
except for the one page, an extra step is required:

at the end of local/config.php:

include_once("$FarmD/scripts/pgcust.php");
include_once("$FarmD/cookbook/improvedrecipe.php");

Then as above, in local/Test.ProtectEmailOriginal.php

$EnableImprovedRecipe = 0;

at the start of improvedrecipe.php:

SDV($EnableImprovedRecipe, 1);
if (!$EnableImprovedRecipe) return;

JR
-- 
John Rankin
Affinity Limited
T 64 4 495 3737
F 64 4 473 7991
021 RANKIN
john.rankin at affinity.co.nz
www.affinity.co.nz





More information about the pmwiki-devel mailing list