Ok, I know this is something silly, but I’m using $FNS->prep_conditionals() from within a MCP file. Just for testing I’m running the conditional on the following ‘template’:
$day = "{if entries}entries{/if}{if not_entries}not-entries{/if}";
This is the PHP running:
$variables = array('entries'=>'TRUE', 'not_entries'=>'FALSE');
$day = $FNS->prep_conditionals($day, $variables);
And here’s what I get:
{if TRUE}entries{/if} {if FALSE}not-entries{/if}
Is there a reason the variables are getting replaced correctly but not parsed? Does the prep_conditionals method have to be run from a template?
Thanks mark.
Yes, the prep_conditionals merely takes the array of data given to it and does matching in the EE conditionals to output a more PHP-parsable conditional that can then be converted later to real PHP and processed by eval(). You can see this happening around line 2839 of core.template.php in the current build of 1.6.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.