Appendix A. Typical Legacy Page Script

<?php 2 include("common/db_include.php"); 3 include("common/functions.inc"); 4 include("theme/leftnav.php"); 5 include("theme/header.php"); 6 7 define("SEARCHNUM", 10); 8 9 function letter_links() 10 { 11 global $p, $letter; 12 $lettersArray = array( 13 '0-9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 14 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 15 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' 16 ); 17 foreach ($lettersArray as $let) { 18 if ($letter == $let) 19 echo $let.' '; 20 else 21 echo '<a class="letters" ' 22 . 'href="letter.php?p=' 23 . $p 24 . '&letter=' 25 . $let 26 . '">' 27 . $let 28 . '</a> '; 29 } 30 } 31 32 $page = ($page) ? $page : 0; 33 34 if (!empty($p) && $p!="all" && $p!="none") { 35 $where ...

Get Modernizing Legacy Applications in PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.