Gränssnittsdesign


MVC del2


Overview

Model: Manages the data and business logic.

View: Outputs the final user interface and presents data to the user.

Controller: Handles the user requests, manipulates the model, and selects the view to display.

Directory Structure

Core Components

Database.php:

Handles database connection and queries.

Controller.php:

Base controller with common functionality for other controllers.

Model.php:

Base model providing common data handling methods.

 

Model

Article.php

 

View /views/home/index.php 

 

 

Controller

HomeController.php

 

ArticleController.php 

 

Front Controller index.php (The single entry point) 

Explanation Controllers:

HomeController for serving the homepage, and ArticleController for handling article-related requests.

Models: Article model to handle data related to articles.

Views: Separate directories for home and articles, each containing PHP files for different views.




Den här sidan designades av 21C: