0% found this document useful (0 votes)
3 views

Exploring the Code

Uploaded by

Mungara Shubham
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Exploring the Code

Uploaded by

Mungara Shubham
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Understanding Example MVC-ADVANCED

SHUBHAM MUNGARA

Exploring the Code:

3) The content of the displayed page depends on two important parameters: target and function. What
are the default values of these parameters (without clicking on the links on the home page)?

When no parameters are passed to the page in the URL (e.g., visiting the site at /index.php without query
strings), the system will display the Home page of the users target by using the home function. This results
in: • The view displayed: views/home.php • The title of the page: "Home page".

4) Which files are used to display the first page (containing the html code used to code the visuals on
this page)?

The files used to display the first page:

• header.php (common header section for all pages).

• home.php (displays the homepage content).

• footer.php (common footer section).

5) In which folder is the file that calls these visual pages located?

The views folder contains files:


Understanding Example MVC-ADVANCED
SHUBHAM MUNGARA

6) Does the display of the homepage involve files from the folder?

Yes, files from the controller folder are involved in the homepage will display.

7) From the home page, click on the link that displays the list of users. From the URL on the browser,
indicate the value of the target and function variables.

http://localhost/Example-MVC-ADVANCED/index.php?target=users&function=list

8) Which view files are requested to display the resulting table?

The Views list.php are requested to display the resulting table.

9) Find the function that retrieves the list of users and give its name.

function getAllUsers

10) Identify the SQL query in the code for this function. Describe this query.

function getAllUsers(PDO $db): array { $query = 'SELECT * FROM users'; This function selects all the values
in the table users and displays them
Understanding Example MVC-ADVANCED
SHUBHAM MUNGARA

11) In which folder is this function to be found?

Models/requests.users.php

12) From which folder do you call this function?

The controllers folder contains files, like users.php, that call the getUsers() function.

13) To retrieve the list of users from the database, you first need to connect to the database. In this
phase we specify the url to the server that contains the database, the database name, and the
connection parameters: login and password. Find the part of the code that provides this connection
before executing the request.

The models/connection.php file includes the database connection logic.

14) Propose a summary diagram illustrating the steps involved in displaying the list of users, specifying
the order of the files involved and highlighting the MVC (Model-View-Controller) design pattern.

You might also like