|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jul 2009
Posts: 1,527
|
Object Oriented PHP using NetBeans
Hi everyone.
I normally code using structural/procedural programming and have only recently started to look into object oriented PHP. I am using netbeans and want to incorporate the MVC model. I am trying to understand how it all works and the way in which i link them together. I think it is not too difficult to get my head around it all but i was hoping that there would be a tutorial that i could follow so understand how it all works. For example, which files would go into the model, view and controller? Also how the syntax changed etc.. Can anyone help me with this? Regards Billy |
|
|
|
|
|
#2 |
|
SitePoint Evangelist
![]() ![]() ![]() ![]() Join Date: Feb 2007
Location: UK
Posts: 594
|
Uh, NetBeans is just an IDE that you press keys in. It has nothing to do with MVC or OOP, at all.
__________________
Me on StackOverflow | Blog & personal website. I mostly use: PHP, Java, JavaScript, Android. |
|
|
|
|
|
#3 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jul 2009
Posts: 1,527
|
ok maybe i was slightly vague. I will netbeans as the software to build websites.
BUT... i need to understand how MVC works in terms of php and the way in which the files are set up. For example, i usually have all of my sql queries, design etc on one page. This is changed when using oop and mvc.. So are there any tutorials etc i can look at as i cant seem to find any good ones.
__________________
PHP/ASP.NET Developer - Happy Ramadan ![]() Kind regards Billy
|
|
|
|
|
|
#4 |
|
SitePoint Evangelist
![]() ![]() ![]() ![]() Join Date: Feb 2007
Location: UK
Posts: 594
|
There are plenty of good tutorials on the web and topics on SitePoint. Also see the Symfony link in my sig for an open-source MVC framework -- that should give you a good idea.
__________________
Me on StackOverflow | Blog & personal website. I mostly use: PHP, Java, JavaScript, Android. |
|
|
|
|
|
#5 |
|
Twitter: @AnthonySterling
![]() Join Date: Apr 2008
Location: North-East, UK.
Posts: 4,053
|
Basic MVC in 5 minutes huh?
view-entry.php?id=1 PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
HTML4Strict Code:
__________________
@AnthonySterling: Full-time IT Manager, part-time Freelance PHP Ninja. Also future, drunk, attendee of the PHPNW10 Conference - come say hello! ![]() |
|
|
|
|
|
#6 |
|
SitePoint Member
Join Date: Jun 2009
Posts: 7
|
Beautifully explained Anthony.
I want to become a PHP ninja like you! ![]() Now, were you to query a database to pull the contents would you put your SQL inside the model? I am also just starting to get to grips with MVC. |
|
|
|
|
|
#7 |
|
SitePoint Zealot
![]() ![]() Join Date: Oct 2003
Location: Pennsylvania
Posts: 191
|
Yes, the model is where the SQL would go.
__________________
Scott |
|
|
|
|
|
#8 | |
|
Twitter: @AnthonySterling
![]() Join Date: Apr 2008
Location: North-East, UK.
Posts: 4,053
|
Quote:
Yes, the model is responsible for retrieving/providing data. A rough non-functional example would be... PHP Code:
__________________
@AnthonySterling: Full-time IT Manager, part-time Freelance PHP Ninja. Also future, drunk, attendee of the PHPNW10 Conference - come say hello! ![]() |
|
|
|
|
|
|
#9 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jul 2009
Posts: 1,527
|
Same here josebb, i currently program procedurally but have been learning MVC and it looks like its the way to go
![]() I will try AnthonySterling's(aka SilverBullet ??) kindly suggested example and see how it all works..
__________________
PHP/ASP.NET Developer - Happy Ramadan ![]() Kind regards Billy
|
|
|
|
|
|
#10 |
|
SitePoint Enthusiast
![]() Join Date: Oct 2004
Location: Melbourne, VIC, AU
Posts: 83
|
MVC is just a design pattern for Object Oriented Programming (OOP). what you are really doing is learning OOP techniques and then applying the MVC design pattern to suit the application. You could apply any other design pattern if it suited the task, but the base code will always be OOP.
|
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 01:09.






Happy Ramadan







Linear Mode
