Here are my thoughts, feel free to shoot them down. How about create a form object and add to it and then add a function on it to return the html? (please excuse my makeshift syntax for explaining haha)
CForm theform = new CForm(action, method, etc, etc);
theForm.addItem(new FormItem());
theForm.addItem(new FormItem());
theForm.addItem(new FormItem());
echo theForm->getFormHtml();
when getFormHtml() is called it would look in to an internal array of FormItems and begin building the html. one step further... the FormItem could have it's own getHtml().
public function getFormHtml()
{
String html;
foreach(FormItem item: FormItemArray)
{
html .= item.getHtml();
}
return html;
}
which would return your entire form..
<form>
<input...>
</form>
Quote
While your point is true, I found other frameworks are doing the same thing as Yii. Creating a function like closeTag()/closeForm() also brings us more trouble than benefit.
Yes, there would be no added benefit. The developer would still need to remember to call that method, and calling a method will add some overhead.