mopardude Posted May 15, 2011 Report Share Posted May 15, 2011 I was watching Stefan's vids on beginning class progamming over at the killerphp.com site. I get what he means about keeping the view code seperate from the business logic when creating classes. So does that mean it would be frowned upon to create a class that filled in table data for example? I mean I realize it is possible to program this, but like he said it is possible non-coders might have to make changes to the page like css or whatever. What would be the right way to handle this situation? Quote Link to comment Share on other sites More sharing options...
falkencreative Posted May 15, 2011 Report Share Posted May 15, 2011 I think that's a situation that falls somewhere in the middle. It isn't frowned upon -- CodeIgniter has a HTML Table class that I have used often, and it's quite useful. http://codeigniter.com/user_guide/libraries/table.html I think the goal is to ensure that the class doesn't generate any unnecessary/excess markup (unnecessary inline styling, classes/ids that are set by the class and aren't easily editable, etc.) If you need a way to set CSS classes on the table/table columns or rows, make those easy to edit by calling a function within the class, rather than having the PHP class itself set that data. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.