Welcome Guest, Not a member yet? Register   Sign In
Best practices with modules, CI, and seperating idea.
#2

[eluser]BrianL[/eluser]
What you need are not programming best practices but web best practices. First, use modern design by using <div> tags with id attribute to wrap every single view (except possibly the main view for each page). Then when loading views, load them into a string in whatever order you choose. You can create your header, footer, menu bar, and content in whatever order you please each with individual view files. Now since each view file will be wrapped in a div tag with a id, you can place it exactly how you want with CSS. Basically you will have ultimate separation of presentation and logic layer, completely unlike ASP.NET. I suggest creating a custom naming convention for views based on the controller name, for example call your views [controller name]_[id number] and [controller name]_main for the main view. You do not need to worry about exactly how you break up your views, because that will all be handled and positioned exactly with CSS. How "fine grain" you want your views will depend entirely on your needs. The lowest level is generally a view a foreach loop, and the highest level are views for your headers, footers and body. Again I suggest you invent your own naming convention.

I suggest this. Views should be broken up to avoid any looping and as little PHP in the view as possible; only enough PHP to access variables. With PHP out of the way you can give the views to a web designer with no knowledge of PHP and only basic knowledge of HTML if necessary, and they can alter CSS and javascript at will without touching your code.


Messages In This Thread
Best practices with modules, CI, and seperating idea. - by El Forum - 07-17-2010, 03:49 PM
Best practices with modules, CI, and seperating idea. - by El Forum - 07-17-2010, 05:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB