6
Hello. I am wanting to build my own application using the MVC standard. I understand the separation of each item(Model, View and Controller). But I want to make some sort of separation between the Front-end and the Back-end, since some backend controllers will have the same name as Frontend’s.
I cannot visualize something that is simpler to create this constraint. Does anyone have any idea how to do?
What do you call "front-end controler"? the ones that are used with ajax?
– Sergio
There must be 5 or 6 questions that look like this.
– Maniero
It is not a simple thing to explain, but I believe that the set of classes here https://github.com/szagot/config will help you to work separation, in particular the Uri class (https://github.com/szagot/config#Uri).
– Szag-Ot
Sergio, frontend controllers are the PHP manipulations with the database that generate the printable information in the View HTML
– Thiago da Victória Nunes
@Szag-Ot I actually need a physical separation between Frontend and Backend
– Thiago da Victória Nunes
@In this case, just create the "admin" (the q vc is calling the backend) with the same structure, treating the /admin/ (or the name q wish) as a separate system, with its own htaccess (if applicable). Hence just set a folder for crontollers in common.
– Szag-Ot
@Szag-Ot Where would I put this admin to replace the backed?
– Thiago da Victória Nunes
@Thiagodavitoriaanunes in the root itself... or anywhere else you prefer. The structure within admin/ would be the same as that of the root folder, but the models crontrollers would be from the administrative, whereas at the root would be from the public access (store, blog, etc...).
– Szag-Ot
@Szag-Ot I see. My debt is: I will need Views, Controllers and Model (this can be one, both for frontend and backend/admin) Would I create other controller and view folders within the admin folder? [I’m looking for the smartest way to create these mechanisms]
– Thiago da Victória Nunes
@Thiagodavictorianunes I believe depends a lot on your business rule. But usually the models that govern the rules of business should stay in one place. This should not be a problem if you are following a standard such as PSR-0 or PSR-4 (http://www.php-fig.org/psr/psr-4/). If you want to show the controllers and the views, since these are individual, target them by the controllers, you can also set them all at the root, leaving only the views separately. I’ll see if I can buy you some time so I can create a General Division model for you
– Szag-Ot
@Szag-Ot Right. Thanks man. I’m used to having Frontend and Backend Controllers and Views separate, as well as js, css and other files. I wanted to create a different structure from this one. I appreciate the help.
– Thiago da Victória Nunes
I recommend exploring the generators of Yeoman, for example the Generator-angular-php and Generator-angular-Fullstack.
– Bruno Wego
@Brunowego I’ll write it down here. Thank you.
– Thiago da Victória Nunes