+ // Write the chapter.
+ if ($display_chapter) {
+ // If there is a valid chapter, display it.
+ $help_info = get_info($doc, 0);
+ $ch = array();
+ $ch['Chapter'] = $chapter;
+ $ch['Title'] = $help_info[0];
+ $ch['Summary'] = isset($help_info[1]) && $help_info[1] ? trim($help_info[1]) : $help_info[2];
+ $ch['Sections'] = array();
+ $section = 0;
+ for ($n = $help_info[3], $cnt = count($doc); $n < $cnt; $n++) {
+ $section++;
+ $help_info = get_info($doc, $n);
+ $n = $help_info[3];
+
+ $a = array();
+ $a['SectionNumber'] = $section;
+ $a['SectionTitle'] = $help_info[0];
+ $a['SectionText'] = isset($help_info[1]) ? trim($help_info[1]) : '';;
+
+ $ch['Sections'][] = $a;
+ }
+
+ $oTemplate->assign('chapter_number', $chapter);
+ $oTemplate->assign('chapter_count', count($helpdir));
+ $oTemplate->assign('chapter_title', $ch['Title']);
+ $oTemplate->assign('chapter_summary', $ch['Summary']);
+ $oTemplate->assign('sections', $ch['Sections']);
+ $oTemplate->assign('error_msg', NULL);