PHP variables set inside an EE loop are reset to a EEish value… kinda… when the loop ends?
Example:
<?php
$aaa = 1;
?>
{exp:channel:categories channel="gallery"}
{if active}
<?php
$aaa = "{category_id}";
echo 'AAA: '.$aaa;
?>
{/if}
{/exp:channel:categories}
<?php
echo 'BBB: '.$aaa;
?>...will return:
AAA: 3
BBB: {category_id}Why is this so?
And how are we supposed to work around it?