I have been developing some functionality to PHP applications, but I haven't myself been making design or too much logic in the applications. Just algorithms and data structures, so I haven't been needing to understand how the application works.

Now I have looked into frameworks and application structure, and I start wondering what the point of template engines are when working with a framework? For example, I am looking into Yii and Zend framework and the use of Smarty templates. Most of the HTML output is generated by PHP code, and in the end all this HTML is inserted into an almost empty HTML file.

Many of my templates are just empty shells where I insert a Zend Form. I don't see the need for templates. Is there something I have missed, can someone put me in the right direction?