Seeking general advice: is there a better way to echo dynamic HTML than heredoc? (smarty / php / html)
===

Project: To create dynamic multi page form that populates the fields in different ways depending on various situations.

Context: Using CMSMS and Smarty tags to insert PHP into the requried pages. Each single page of the form is being built using a single smarty 

Current Method: Using smarty tags, I am writing large chunks of HTML echoed in heredoc notation. When I reach a part of the form that needs to be dynamically genearted (such as a drop down menu) I escape the heredoc, write the PHP (using standard echo functions to generate the HTML required for that form element) then return to heredoc for more chunks of HTML.

Suspicion: this is inelegant, messy, tedious and just feels wrong.

Request: Any idea of a better way of doing this?