mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-18 19:41:15 +02:00
Fixed typo
This commit is contained in:
@@ -20,7 +20,7 @@ foreach ($db->query('SELECT * FROM table') as $row) {
|
|||||||
|
|
||||||
This is bad practice for all sorts of reasons, mainly that its hard to debug, hard to test, hard to read and it is going to output a lot of fields if you don't put a limit on there.
|
This is bad practice for all sorts of reasons, mainly that its hard to debug, hard to test, hard to read and it is going to output a lot of fields if you don't put a limit on there.
|
||||||
|
|
||||||
While there are many other solutions to doing this - depending on if you prefer [OOP](/#object-oriented-programming) or [functional programming](/#functional-programming) - there must be some element of seperation.
|
While there are many other solutions to doing this - depending on if you prefer [OOP](/#object-oriented-programming) or [functional programming](/#functional-programming) - there must be some element of separation.
|
||||||
|
|
||||||
Consider the most basic step:
|
Consider the most basic step:
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ foreach (getAllFoos() as $row) {
|
|||||||
}
|
}
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
That is a good start. Put those two items in two different files and you've got some clean seperation.
|
That is a good start. Put those two items in two different files and you've got some clean separation.
|
||||||
|
|
||||||
Create a class to place that method in and you have a "Model". Create a simple `.php` file to put the presentation logic in and you have a "View", which is very nearly [MVC] - a common OOP architecture for most [frameworks](/#frameworks_title).
|
Create a class to place that method in and you have a "Model". Create a simple `.php` file to put the presentation logic in and you have a "View", which is very nearly [MVC] - a common OOP architecture for most [frameworks](/#frameworks_title).
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user