Welcome Guest, Not a member yet? Register   Sign In
Help Newbie, Multiple Classes on Page
#1

[eluser]tonyurso[/eluser]
Ive been a php developer for some time But I never taught myself OOP so I'm a complete knob when it comes to MVC.

Every tutorial I've read has 1 controller that outputs one page.

My question is, what is the best practice for building a page that utilizes many classes?

for example on my index page I may have the following classes:

header
footer
main content
a login box
a feed for recent posts
ect ect

I'am assuming that all of the above would have their own classes and views?
How do i go about this?
I apologize if this sounds dumb, I think I making this harder than it seems.





#2

[eluser]tonyurso[/eluser]
Alright, I guess what im looking for is modular-extensions-hmvc
Any input on this would be great!
#3

[eluser]vincej[/eluser]
Like you I was also a newb about 18 months ago, and indeed you are making this all too hard. You do not need separate classes for each of these entities. You only need 2 classes: a controller class and a model class. I think CI gives you those to start with - check the user guide. Then all you do is extend them with your own class definition.

You can not learn OOP and MVC from the forums - there is just too much to learn and attempting to tackle CI without having a grip of that first and you will not succeed.

I tell all newbs the same:

Get a copy of Tom Myers “Professional Codeigniter” - don’t worry about the fact that it was written when CI 1.7 was around the differences are tiny. It will really accelerate your understanding of the MVC framework. Then turn to the user guide - a very valuable document !!

Before you know it you will be writing apps !

http://www.amazon.com/Professional-CodeI...0470282452

Goodluck !




Theme © iAndrew 2016 - Forum software by © MyBB