6.7. Creating Different Viewing Styles for the Pages

You're nearly finished with this stage of your blog's development. However, if you navigate to the "About the Author" page, you'll see that it shows an entry preview. This is undesirable because there should be only one entry on this page.

To fix this, you need to modify your retrieveEntries() function to force the "About the Author" entry to be a full-display entry, even without a URL being supplied.

Open functions.inc.php and modify retrieveEntries() by inserting the following code in bold into the while loop starting at line 38:

// Loop through returned results and store as an array
        while($row = $stmt->fetch()) {
            if($page=='blog')
            {
                $e[] = $row;
                $fulldisp = 0;
            }
            else
            {
                $e = $row;
                $fulldisp = 1;
            }
        }

You also need to remove the original line that defaults $fulldisp to 0. Remove this line from functions.inc.php:

// Set the fulldisp flag for multiple entries
        $fulldisp = 0;

Now you can view the full "About the Author" entry by navigating to http://localhost/simple_blog/about/ in your browser (see Figure 6-11).

Figure 6.11. The full "About the Author" entry display

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.77.63