4 ms·
PHP was originally invented to be a templating language. Your templating logic can still reside in a PHP file, function, or class, the same way it can in javasc
by debaserab2 7y ago
PHP was originally invented to be a templating language. Your templating logic can still reside in a PHP file, function, or class, the same way it can in javascript with JSX.
WordPress isn't bad because it uses PHP as a templating language (I think it's just the go-to "bad PHP codebase" example people use without really understanding why they are citing it). It's bad because it has competing code patterns that it evolved over time because it has to maintain backwards compatibility with an entire plugin ecosystem that is now decades old.
- codesushi42 7y agoThat is not true. I had to work with WordPress years ago, and one of the reasons it was so terrible is that it went to great lengths to mix view and business logic by interspersing PHP with HTML all over the place.
- debaserab2 7y agoYet React projects mix view and business logic by design and aren't usually that confusing to make changes to. That's not the reason the WP codebase is bad.
- codesushi42 7y agoMVC does not mix view and business logic.
- debaserab2 7y agoReact isn't MVC.
- codesushi42 7y agoReact is MVVM, a variant of MVC. React does not mix business logic and view logic in the same scope.