How hiepfre3101/food_lum works
Main Components
• Client-facing Frontend: This is composed of the "view" directory (which contains pages like home, login, signup, product detail, order pages) and the "template/site" directory (which provides HTML templates for the user interface).
• Admin Dashboard: Separated into the "admin" directory, specifically under "admin/view", which hosts various PHP pages for administration such as managing categories, products, orders, comments, users, sliders, and vouchers.
• Controllers: The "controller" directory contains PHP files that implement the business logic (e.g., c_client.php, c_admin.php, c_order.php). They coordinate request handling by bridging the frontend and the underlying data layers.
• Models: Found in the "model" directory, these files deal directly with the database interactions (e.g., m_product.php, m_order.php, m_user.php) and include configuration files for DB connections.
• Mailing Module: The "mail" directory, especially "mail/send_mail", incorporates PHPMailer along with related configuration and language files. This component is responsible for the email functionality within the web application.
• Configuration Files: Scattered across "controller/config.php", "model/config.php", and similar, which likely hold common settings for DB, server, or other environment variables.
• Entry Points: The "index.php" file acts as the primary entry point for the website, handling the initial dispatch of requests.
Relationships and Interactions
• The user (or admin) interacts with the website via the UI pages (in "view" and "template/site"). Requests are sent to "index.php" or other routing scripts.
• These requests are forwarded to the appropriate controller (found in the "controller" directory), where the business logic is executed.
• Controllers interact with the models (in the "model" directory) to retrieve or update data from the database.
• Once the logic is processed, controllers call the views to render the HTML content, using standard PHP view files (both in "admin/view" for the backend and "view" for general pages).
• For email notifications or confirmations, the application integrates the mailing module in the "mail/send_mail" directory.
• The public directory serves the static assets required for both the frontend and admin sections of the site.
Architectural Patterns and Design Principles
• MVC Pattern: The clear separation into Models, Views, and Controllers helps modularize the design.
• Separation of Concerns: Differentiation of client vs. admin modules ensures clear domain boundaries.
• Reusability & Extensibility: With templated HTML in the "template" directory and the modular mailer component, the design supports reuse and potential future extensions.
• Dependency Handling: Configuration files ensure that dependencies like database connections and external APIs (like VNPay) are managed centrally.