Answer the question
In order to leave comments, you need to log in
PHP questions: OOP, templating
Hello. I am writing a not so big music information portal (in the future there is something global).
Questions arose:
Does it make sense to do everything in OOP? As I imagine it...
There is page.php and classPage.php lies nearby. I do include in page.php. Well, of course there are classes.
The second issue is the template engine. I tried looking at Smarty and a few similar ones, but they work slowly and there are a lot of unnecessary functions. Show an example of how to do it yourself.
I say right away, do not offer frameworks.
Answer the question
In order to leave comments, you need to log in
Sense to do everything on OOP - yes. Otherwise, your "not so big music information portal", when finalized into "something global", will turn into a bunch of code that is easier (and more correct) to throw out and rewrite.
If you don’t want to use frameworks (which is very in vain: Yii, Symfony are gorgeous frameworks on which you can raise a project that will constantly grow and develop over time), then look towards the MVC scheme, (Model-View-Controller), read about design patterns, (about design in general), and write your own lightweight application.
Template engine? PHP itself is a great templating engine.
If you don't want frameworks, try MICROframeworks.
For example, Silex. There is Twig. ;)
Judging by your question, there is no point in advising you - you do not understand well what software development is in principle.
Here's the proposal - it solves everything. Until you understand what is wrong here, it is pointless to advise you. Write yourself how you want, grab injections, have problems with code development. When you go through this - it will be possible to advise you on the framework.
My choice is number two.
Take it, take it through composer.json:
https://github.com/gabordemooij/redbean
https://github.com/fabpot/Twig
Just don't forget to do in the initialization code:
require_once 'path/to/vendor/autoload.php';
use RedBean_Facade as R;
Strictly speaking, what are the contraindications to the use of frameworks? Why don't you want to do this work quickly and conveniently?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question