cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

Standardized setMainView() and setTemplateAfter()

Open Cmssspl opened this issue 13 years ago • 2 comments

No one invention, if im set $view->setMainView(xyz) and if he exist -> include, if not exist -> nothing will happen. If set setTemplateAfter(xyz) and if dont exist return fatalerror.

I think it should be standardized. I propose to be the way setMainView().

Cmssspl avatar Feb 03 '13 13:02 Cmssspl

There is an automatic behavior, the view component looks for a view with the same name as the latest executed action, a layout with the same name as the executed controller and a main view (views-dir/index), so any additional condition within this scenario is treaded as something that must be susceptible of exceptions, what if a user misspells a layout name?, the component cannot just simply ignore that, because it would also checking if the layout exist in every request as it is an unnecessary call (stat) to the operating system on each request impacting performance

ghost avatar Feb 04 '13 08:02 ghost

Ok, so are the main view and controller layout, which are added only if there is. Of course, it was just my suggestion. ;-)

Cmssspl avatar Feb 04 '13 20:02 Cmssspl