# Blog List Page

Now we'll create the blog list page for our control panel. This page will be very similar to the blog/index.php page that we created in a previous step. In this case the page will be part of the control panel, and you must login before you can view it. It will allow the site administrator (you) to choose blog posts to edit, and to create new blog posts (we'll build that page in the next step). For now, we'll just work on showing a list of all blog posts.

In the previous step you created the control panel home page, and put a link in it to the 'blog list' page. The link doesn't work right now, because we haven't created the blog-list.php page (in the control-panel folder). We'll do that in this step. Unlike the blog home page that we worked on earlier, the blog list page will display a list of all blog pages (not just the ones that are 'active').

This step should be fairly easy, because we can re-use some code that we've already written. We'll use the getPageList() method of the PageDataAccess class.

1. Create a new page inside the control panel folder and name the file blog-list.php
2. Add the boiler plate code, as we have been for all the new web pages that we've been adding to our site. Make sure to include the authentication-check.inc.php file (to make sure that anyone who visits this page must first log in). Also make sure to include the PageDataAccess class. We'll be calling the getPageList() method in a bit.
   The code should look something like this.
3. Add a function to the bottom of the page, it will be very similar to the function you made for the blog home page.
   The code should like this.
4. Now add this code, just under the H3 element. Note the following:
   - There is a hyper link to blog-details.php, a page that we have not yet created (but we'll do that in the next step).
   - The PHP code instantiates the PageDataAccess class, then calls the getPageList() method. By passing FALSE as the parameter, we are indicating that we want all the blog posts from the database (not just the 'active' ones). This method call should return an array containing the blog pages from the database.
   - The array is then passed into the displayPages() function, which displays the blog posts in an HTML table.
5. Now open the blog-list.php page in the browser. You should be redirected to the login page. Once you log in, you should be able to visit the page. And you should see a table that displays all the blog pages from the database. Notice that the last column in the table has a link to the blog-details.php page (which we will create in the next step). It doesn't look very good right now, maybe we should spend some time on the CSS to make the page look better.
6. In the next step things will get complicated. We'll create the blog-details.php page, which will allow you to add new blog pages to your site, and to edit blog pages as well.