this is my first post on StackOverflow.
First of, i'm not an expert, I know "i shouldn't make a CMS, go to Open Source", but my case here is study, i want to know how things are done and how can i do my own things. I also don't want to use any framework, i want to learn. So let's go.
I'm building a MVC CMS:
- Index call routes;
- routes call respective controller;
- controller instances every model i need and continue the process using their methods;
- controller calls the view;
This is the basic logic of my CMS, but i stuck in some things.
1) Since i don't using any singleton class, i using dependency injection to pass some class like database to models and page attributes (like title, description) to views, but i got a problem when calling my view, because i want able to use themes, so my view calls my theme (eg: index_view.php calls {theme_folder}/index.php), and my index.php from my themes folder does't recognize $page_title, $description, etc. I think that some logic or concept are wrong here.
2) I using constants on my settings.php, but i don't know if they are considered "God Objects", since i can use then everywhere from my project. It includes __DB_PASSWORD, __APP_ROOT, __SITE_WWW (i based this idea on Wordpress), but this is really correct? Cause on my controllers i have to use __APP_ROOT always that i have to call a view or a model, and i avoid create dependency with my models, because i can pass this value on parameters.
3) Using PDO persistent connections is safe to my project? I never understant how persistent connections are handled.
4) Although it's a study project, i want to make it consistent to take base on my future projects.
Thanks, and remember, this is for study purposes, i have some experience with PHP but it's my first time on MVC following design patterns, so i WILL make mistakes.
:)
Aucun commentaire:
Enregistrer un commentaire