17) { die("There's no such thing as chapter $chapter!"); } $is_numeric_chapter = true; } } }/*}}}*/ function get_context_links($ch) {/*{{{*/ global $chapterDescs; $a = array('prev' => array(), 'next' => array()); if(is_numeric($ch)) { $n = intval($ch); $a['next']['url'] = $n + 1; $a['next']['link'] = "Next Chapter: {$chapterDescs[$a[next][url]]}"; $a['prev']['url'] = $n - 1; $a['prev']['link'] = "Previous Chapter"; if($n == 1) { $a['prev'] = array('url' => "intro", 'link' => "Introduction"); } else if($n == 17) { $a['next'] = array('url' => "", 'link' => "Back home!"); } } else { if($ch == "intro") { $a['prev'] = array('url' => "", 'link' => "Back To The Home Page"); $a['next'] = array('url' => "1", 'link' => "Chapter One"); } else if($ch == "luggage") { $a['prev'] = array('url' => "", 'link' => "Back To The Home Page"); $a['next'] = array('url' => "intro", 'link' => "Onwards to the Introduction"); } else if($ch == "contents") { $a['prev'] = array('url' => "", 'link' => "Back To The Home Page"); $a['next'] = array('url' => "intro", 'link' => "Onwards to the Introduction"); } else if($ch == "homepage") { $a['prev'] = array('url' => "contents", 'link' => "Table of Contents"); $a['next'] = array('url' => "intro", 'link' => "Introduction"); } } return $a; }/*}}}*/ $chapterNames = array(1 => "One", "Two", "Three", "Four", "Five", "Six", "Seven",/*{{{*/ "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", 'luggage' => 'Luggage', 'intro' => 'Introduction', 'contents' => "Book Contents");/*}}}*/ $chapterDescs = array(/*{{{*/ 'intro' => "Welcome to Software Development the Mozilla Way", 'luggage' => "Luggage, Baggage, and (Legal|Nic)ities", 'contents' => "Table of Contents", 1 => "Fundamental Concepts", 2 => "XUL Layout", 3 => "Static Content", 4 => "First Widgets and Themes", 5 => "Scripting", 6 => "Events", 7 => "Forms and Menus", 8 => "Navigation", 9 => "Commands", 10 => "Windows and Panes", 11 => "RDF", 12 => "Overlays and Chrome", 13 => "Listboxes and Trees", 14 => "Templates", 15 => "XBL Bindings", 16 => "XPCOM Objects", 17 => "Deployment" );/*}}}*/ function get_title() {/*{{{*/ global $chapterName; global $chapterDesc; global $chapter; $titles = array(/*{{{*/ 'luggage' => "Legal information for the online version of Nigel McFarlane's Rapid Application Development with Mozilla", 'contents' => "Table of Contents for the online version of Nigel McFarlane's Rapid Application Development with Mozilla", 'homepage' => "Rapid Application Development with Mozilla (online book)" );/*}}}*/ if(array_key_exists($chapter, $titles)) { return $titles[$chapter]; } else { $title = "$chapterName: $chapterDesc"; if(is_numeric($chapter)) $title = "Chapter $title"; } return $title; return "$title, from Rapid Application Development with Mozilla (online book)"; } /*}}}*/ function get_meta_desc() { // {{{ global $chapterName; global $chapterDesc; $metaDescs = array( 'intro' => "Introduction to", 'luggage' => "Legal information for", 'contents' => "Table of Contents for" ); if(array_key_exists($chapter, $metaDescs)) { $desc = $metaDescs[$chapter]; } else { $desc = "Chapter $chapterName ($chapterDesc) of "; } return "$desc the online version of Nigel McFarlane's Rapid Application Development with Mozilla."; } /*}}}*/ // Returns something like "Chapter Six" or "Introduction" function chapter_header_text() { // {{{ global $chapter; global $chapterName; if(is_numeric($chapter) ) return "Chapter

$chapterName

"; else if(!empty($chapterName)) return "

$chapterName

"; else return "

$chapter

"; } // }}} function top_ads() { // {{{ return ""; $s1 = << RV; $s2 = << RV; return "
$s2
"; } // }}} function side_ads() { $side = << ZZZ; return "
$side
"; } function bottom_buttons_table() { // {{{ global $links; global $SCRIPT_URI; $page_url = urlencode($SCRIPT_URI); return << Get Firefox! Not Quite Valid XHTML 1.0 Transitional Valid CSS Crafted with jEdit ( http://jedit.org/ ) RV; } // }}} validate_chapter(); $links = get_context_links($chapter); $chapterName = $chapterNames[$chapter]; $chapterDesc = $chapterDescs[$chapter]; // {{{ Serve XHTML to capable browers, text/html to others if(!stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml') || preg_match("/application\/xhtml\+xml\s*;\s*q=0/", $_SERVER['HTTP_ACCEPT']) ) { header('Content-type: text/html; charset=utf-8'); } else { header('Content-type: application/xhtml+xml; charset=utf-8'); echo ''; } // }}} $SCRIPT_URI = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; $ua = $_SERVER['HTTP_USER_AGENT']; $is_Mac = stristr($ua, 'Mac'); $is_IE = stristr($ua, 'MSIE') !== false && stristr($ua, 'opera') === false; ?> <?php echo get_title(); ?>

Not Perfectly Accurate Diagram