Refusing to use a common template engine As the title says, I refuse to use a common template engine. I have my reasons, so instead of doing this:

&lt;ul&gt;
&lt;li&gt;&lt;a href = "#"&gt;test&lt;/a&gt;
&lt;li&gt;{CommonParam}&lt;/li&gt;
&lt;/ul&gt;


I do this:

function listBlock($array){
echo '&lt;ul&gt;';
foreach($array as $foo){
echo '&lt;li' . $foo['args'] . '&gt;' . '&lt;a href = "'' . $foo['link] . '"'&gt;' . $foo['text'] . &lt;/li&gt;';
}
echo '&lt;/ul&gt;'
}

// now we'd call listBlock($myarray)


My question is quite simple... as I'm actually developing my own custom framework, I know it's a bit difficult to maintain this code, but it works great. Is this a good practice?
Answer courtesy of JC

In MVC Frameworks, you will often find this question answered a multitude of ways. Here are two principles that I attempt to live by, with regards to this.


Separate business logic from presentation logic. If the function in question takes input from another source, and simply does some formatting on it, then it is similar to the view helpers used in most MVC frameworks, and thus is separated from any business logic that processed the input to the function. However, if the function itself is doing logic based upon its input to determine other things about the data, other then simply how to display it, you wind up with a situation where if you have more then one case down the road, this function will begin to grow substantially, and eventually may become impossible to understand, or inefficient.
Data processed by the system should be usable in many forms. If your data might be needed for other uses, beyond display, then you may later on find yourself having to refactor, or even duplicate the code, when you realize that you need 'Ted Developer' in 'Developer, Ted', 'Ted Developer' and 'Ted' forms, and your function only returns one of the three.