October 2016
Intermediate to advanced
320 pages
6h 39m
English
Now that we have our model complete, a template render function, we just need to create the view with which we can look at each profile.
Our view will be put inside a foreach block, and we'll use the template we wrote to render the right values:
//listprofiles.php
<html>
<!doctype html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
</head>
<body>
<?php
foreach($results as $item) {
echo profile_template($item->name, $item->age, $item->country;
}
?>
</body>
</html>
Let's put the code above into index.php .
While we may install the Apache server, configure it to run PHP, install new virtual hosts and the other necessary features, and put our PHP code into an Apache folder, ...
Read now
Unlock full access