Your application can generate administrative links at this point; next you need to load those links into index.php. You place your administrative links only on the full display of an entry, so you must place the call to load information from adminLinks() within a conditional statement that fires only if $fulldisp == 1.
In index.php, at line 69, insert the code shown in bold:
<?php // If the full display flag is set, show the entry if($fulldisp==1) { // Get the URL if one wasn't passed $url = (isset($url)) ? $url : $e['url']; // Build the admin links $admin = adminLinks($page, $url); ?>
Now you have an array with your edit and delete links as individual array elements. This means you can insert the links in your layout by adding the code shown in bold:
// Build the admin links $admin = adminLinks($page, $url); ?> <h2> <?php echo $e['title'] ?> </h2> <p> <?php echo $e['entry'] ?> </p> <p> <?php echo $admin['edit'] ?> <?php if($page=='blog') echo $admin['delete'] ?> </p> <?php if($page=='blog'): ?> <p class="backlink"> <a href="./">Back to Latest Entries</a> </p> <?php endif; ?>
NOTE
You're checking whether $page=='blog' before you display the delete link. This is because you don't want to delete your "About the Author" entry; doing that would leave you without any entry for that page. Instead, you want your users to edit the existing entry.
Now loading index.php in a browser and selecting an entry displays your administrative links (see Figure 7-1).