The simplest possible solution I can think of is using the php shorttag, and some kind of MVC (or at least VC) structure:
view.php
<div>
My name is <?= $myName ?>
</div>
main.php
$myName = 'John'; //or $_SESSION['myName'] or whatever
include 'view.php'; // after include the variable $myName will be visible inside of view.php