Answer the question
In order to leave comments, you need to log in
How to properly implement mvc?
Good day. I've watched a lot of tutorials and read enough books, but still don't understand the concept of mvc. Let's say we have several files with .html or .php resolution. If the file exists, the browser shows it; if not, it gives an error about the absence of the file. The problem is the following. I have seen 3 implementations and with which I do not entirely agree.
1) Make one entry point to the site through mod_rewrite so that all requests go to index.php
.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) index.php
Answer the question
In order to leave comments, you need to log in
You have some class App that starts when requested, and it contains a Router that processes the request, parses / siski or index.php?url=siski and decides which controller to call: SiskiContoller.php or SiskiAjaxController.php when the request comes to the controller , it takes data from the Siski model, SiskiContoller re-renders the data to the siski file that is in the views, SiskiAjaxController makes json_encode for the data and displays it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question