A
A
andriuhatm2015-02-24 23:57:34
PHP
andriuhatm, 2015-02-24 23:57:34

Understand how objects work in php with an example?

In general, I began to study OOP in php, but it is not entirely clear how it all looks in practice. And hello worlds don't help. So I started making a site with quotes - for the purpose of study.. It turned out to be functional, but it doesn’t work objectively..
There are category names in the database that I want to display in the sidebar as links, then display quotes on the pages - in the form of an html table - > quote + rating.
How to organize all this?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Shaks, 2015-02-25
@andriuhatm

I advise you to take up the study of OOP frameworks. Then in practice you will already understand what's what and what is the charm of 3 OOP whales. In php, I really like the kohana framework. Or try to delve into the MVC design pattern yourself (Model - model. Responsible for working with the base. View - presentation .. class responsible for working with templates. Controller - controller). In a nutshell, these are 3 base classes from which most of your application grows.
Each table has its own model (Model) as a rule, and all these models will be inherited from the base model. View (view) - for working with html .. and the Controller is between models and views, and tells who to do what. Information on the Internet shaft on MVC.
In parallel, read books about design patterns.

E
Eugene, 2015-02-25
@Nc_Soft

habrahabr.ru/post/153225

F
FanatPHP, 2015-02-25
@FanatPHP

"In general" you need to learn OOP for 2-3 years to start getting something worthwhile.
And two lines won't tell you that on the toaster.
Buy textbooks, read. This is the only option if there is no specialized education.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question