A
A
Alexander Semikashev2014-01-22 13:58:01
PHP
Alexander Semikashev, 2014-01-22 13:58:01

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

5 answer(s)
Z
zum, 2014-01-22
@verng95

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.

M
Mikhail Osher, 2014-01-22
@miraage

If you don't want frameworks, try MICROframeworks.
For example, Silex. There is Twig. ;)

A
Andrew, 2014-01-22
@kaasius

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.

M
Mikhail Osher, 2014-01-22
@miraage

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;

Here, for the base and template engine. Drink the rest yourself. (routing, etc.)

R
Ruslan Kasymov, 2014-01-22
@HDAPache

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 question

Ask a Question

731 491 924 answers to any question