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