'); } function scripts($additional = array()) { return head_component($additional, 'scripts/%s.js', ''); } function head_component($additional, $search, $format) { global $requested; $output = array(); foreach (array_merge(array('application', $requested), $additional) as $file) { if (fe_check(sprintf($search, $file)) !== false) { $output[] = sprintf($format, $file); } } return implode("\n", $output); } $content = null; if (($content_file = fe_check('content/' . $requested . '.html')) !== false) { $content = file_get_contents($content_file); } foreach (array('application', $requested) as $action) { if (($action_file = fe_check('actions/' . $action . '.inc')) !== false) { include($action_file); } } if (($view_file = fe_check('views/' . $requested . '.inc')) !== false) { ob_start(); include($view_file); $content = ob_get_clean(); } if (is_null($content)) { trigger_error("No content generated for ${requested}! Did you create a content, action, or view file for this request?"); } if (($layout_file = fe_check('views/' . $layout . '.inc')) !== false) { ob_start(); include($layout_file); $content = ob_get_clean(); } echo $content;