By design in both engines: an included partial sees the caller's variables and its own assignments stay inside it. Smarty gets a value out with {$seen = true scope='parent'}; Twig cannot, but the platform's set also stores the value in _templateContext, where the caller reads it. The context works the same in both and is the portable choice.