# Slide Title\n"; $lastSection = $lastChapter = ''; foreach($_SESSION['titles'] as $k=>$v) { $spacer = ''; if(!empty($v['section'])) { $spacer = "    "; if($v['section'] != $lastSection) { echo "$v[section]\n"; } } if(!empty($v['chapter'])) { $spacer .= "    "; if($v['chapter'] != $lastChapter) { echo "$spacer$v[chapter]\n"; } } $lastSection = isset($v['section']) ? $v['section'] : ''; $lastChapter = isset($v['chapter']) ? $v['chapter'] : ''; echo "".($k)."$spacer$v[title]\n"; } echo "\n"; ?>