PHP MVC file structure -
how should structure directories in mvc design pattern in php able use same model , controllers in 'backend' , 'frontend' different views.
what have done
i trying build website using php server side language , dediced use mvc design pattern. in localhost (xampp) created folder structure below:
htdocs -- mvc |---- controllers |---- models |---- views |---- library |---- system-admin (backend) |___ controllers |___ models |___ views |___ index.php (single entry point - backend) |___ .htaccess |---- index.php (single entry point - frontend) |---- .htaccess
i tried implement basic 'login-system' , created 'login_controller' , 'login_model' files.
i confused
how can able use 'login_controller' , 'login_model' both backend
, frontend
while using seperate views each. mean , url admins login : http://localhost/mvc/system-admin/login/
, url site users login : http://localhost/mvc/login/
.
i designing backend
using twitter-bootstrap
framework design of frontend
done other may not use framework have used need different views. both backend
, frontend
share files library
. models , controllers shared (such login_model , login_controller) , not (such dashboard_model , dashboard_contoller used in backend think) .
what need
i need guid on structuring directories , judgement on current file structure. have never used design pattern (except singleton
:-) ) nor php frameworks not able make decision on how structure files.
for general set mvc project following: folder structure /frontend/controllers /frontend/models/ /frontend/views/ /backend/[the same frontend] /public/ index.php (here user starts) /libary/ libarys structure user can not access directly views oder models.
Comments
Post a Comment