"; $tag_e = "$tag>"; $tag_s_pos = strpos($html_string, $tag_s); $tag_e_pos = strpos($html_string, $tag_e); if ($tag_s_pos === false || $tag_e_pos == false || $tag_e_pos < $tag_s_pos) return ""; $start = $tag_s_pos + strlen($tag_s); $end = $tag_e_pos; $title = substr($html_string, $start, $end - $start); return $title; } // THE ACTUAL WEBSITE CODE $pages = array(); $grouped_pages = array(); $scanned_dir = scandir('.'); foreach ($scanned_dir as $filename) { if ( is_file($filename) && !in_array($filename, array("index.php", ".", "..")) && preg_match("/^[^\.]+\.(htm|html|xhtml|php|py)$/", $filename) == 1 ) { $content = file_get_contents($filename); $title = get_html_tag_content($content, "title"); array_push($pages, array($title, $filename)); } } foreach ($pages as $page) { $title = $page[0]; $filename = $page[1]; $group = "General"; if ($title == "") { $group = "Untitled"; $title = $filename; } else if (preg_match("/^[^\{\}]+\{.+\}\s*$/", $title) == 1) { $spl = explode("{", $title); $group = $spl[0]; $title = $spl[1]; $group = trim($group); $title = trim(substr($title, 0, strlen($title) - 1)); } if (!array_key_exists($group, $grouped_pages)) $grouped_pages[$group] = array(); array_push($grouped_pages[$group], array($title, $filename)); } ?>