So, what happens if I want to call this variable in the template after modifying it in the snippet. Let’s say I want to do something like this:
<?php $color = "used to be black"; ?>
<?php snippet('palette', array('color' => $color)); ?>
<?php echo $color; ?>
Where my ‘palette’ snippet contains this:
<?php $color = "now is red"; ?>
I want the echo in the template to return “now is red”, but it keeps on giving me “used to be black”. I tried using global
before variables in many different ways, but I couldn’t succeed.