I am just not getting the hang of the MVC model yet. Lots of different answers and different tutorial videos on youtube. I thought it would be effective so show, someone who knows this well, a bunch of my “code” and functionality and see what goes where in an MVC model.
I will just give you my directory, the files in them, what methods or functions they contain:
DIRECTORY >Class >DB.php >Method to establish a connection to the DB >Query the database >Execute queries and return results >Insert to the database >Update the database >User.php >Construct with instantiates a new DB object >Check login status >Find the user inside the DB >Create a user >Update a user >Login a user >logout a user >Input.php >Check for inputs on a page, post or get >Validate.php >Check for valid input >Hash.php >Hash passwords and return >Verify passwords >Session.php >Check for existing sessions >Make sessions >Ger sessions >Delete sessions >Cookie.php >Check for existing cookies >Make cookies >Ger cookies >Delete cookies >Core >init.php >Start sesssion >Autoload class >Contain GLOBAL VARIABLES >Includes >templates >Navigation bar template for logged in users >Navigation bar template for logged out users >Header template >footer template >CSS >css files >JS >js files >register.php >Include the template >HTML register form <?php >Check for input using Input.php >Validate input using Validate.php >Hash password using Hash.php >Register a user using User.php >Redirect user to login.php to login >login.php >Include the template >HTML login form <?php >Check for input using Input.php >Validate input using Validate.php >Varify passwords using Hash.php >Login a user using User.php >Set remember me cookie >logout.php <?php >logout user using User.php >index.php >Greet >Bunch of links
So this is the directory and some basic functionality of the code. How would I rearrange them, Cut them, Stitch them to build this into according to the MVC?
I tried very hard to understand but even if I get some ideas on board, I have very high doubts about it – I am a complete self-learner. I hope this is not stupid and helps me get around this.
Any help is highly appreciated.
If there is some source, guide/PDFbook, that can help me code PHP sites from scratch to deployment, setting up apache server with .htaccess etc… Please point me to it.
If you do not wish to answer, please consider leaving some links, that can help me, in the comments.