Now that we have removed the data access logic from the files that generate frontend pages, let's see how we should modify them. Let's start with the books.php
file:
<?php /** * This page lists all the books we have * PDO Library Management example application * @author Dennis Popel */ // Don't forget the include include('common.inc.php'); // Display the header showHeader('Books'); // Get the books list $books = Model::getBooks(); // now create the table ?> Total books: <?=Model::getBookCount()?> <table width="100%" border="1" cellpadding="3"> <tr style="font-weight: bold"> <td>Cover</td> <td>Author and Title</td> <td>ISBN</td> <td>Publisher</td> <td>Year</td> <td>Summary</td> <td>Copies</td> <td>Lend</td> <td>Edit</td> </tr> <?php // Now iterate over every row and display it while($b = $books->fetch()) ...