function getSiteMap($id) { $sql = "SELECT `id` , `title` , `url`, `published`, `description`, `keywords` " . "FROM `pages` WHERE `parentid` = {$id} ORDER BY `place`"; $rs = mysql_query($sql) or die("Unable to Execute Select query"); $recordcount = mysql_num_rows($rs); if ($recordcount) { echo '<ul>'; while ($row = mysql_fetch_assoc($rs)) { // check if page is published and is not 404 page if ($row['published'] == 1 && $row['id'] != 2) { echo '<li>' . getEntryHTML($row); if ($row['id'] != 1) { getSiteMap($row['id']); } echo '</li>'; } } echo '</ul>'; } }
$term = ''; $searchresults = ''; // Search all the pages in the database if (isset($_GET['term'])) { $term = trim($_GET['term']); if (strlen($term) > 0) { $searchresults = "<h4>Results for <span class='highlight'>{$term}</span></h4>"; $sql = "SELECT `id` , `title` , `url`, `description`, `keywords` FROM `pages` WHERE ( \n\t\t\t(`title` LIKE '%{$term}%') OR (`description` LIKE '%{$term}%') OR (`keywords` LIKE '%{$term}%') ) \n\t\t\tAND (`published`=1)"; $rs = mysql_query($sql) or die("Unable to Execute Select query"); $recordcount = mysql_num_rows($rs); if ($recordcount) { $searchresults .= '<ul>'; while ($row = mysql_fetch_assoc($rs)) { // check if found page is not the search or 404 page if ($row['id'] != $id && $row['id'] != 2) { $searchresults .= '<li>' . getEntryHTML($row, $term) . '</li>'; } } $searchresults .= '</ul>'; } else { $searchresults .= '<h5>Sorry, nothing was found for this term.</h5>'; } } } ?> <!DOCTYPE html><html><head> <title><?php echo $title; ?> </title>