diff --git a/.htaccess b/.htaccess index a899349..75ba2c0 100644 --- a/.htaccess +++ b/.htaccess @@ -1,3 +1,9 @@ +# Make HTMLy handle any 404 errors. +ErrorDocument 404 /index.php + +# Set the default handler. +DirectoryIndex index.php index.html index.htm + # Requires mod_expires to be enabled. diff --git a/system/includes/functions.php b/system/includes/functions.php index e3913e1..601f495 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -360,42 +360,46 @@ function get_static_post($static){ $posts = get_static_pages(); - $tmp = array(); + if(!empty($posts)) { - foreach($posts as $index => $v){ - if(strpos($v, $static.'.md') !== false){ - - $post = new stdClass; - - // Replaced string - $replaced = substr($v, 0, strrpos($v, '/')) . '/'; - - // The static page URL - $url = str_replace($replaced,'',$v); - $post->url = site_url() . str_replace('.md','',$url); - - $post->file = $v; + $tmp = array(); + + foreach($posts as $index => $v){ + if(strpos($v, $static.'.md') !== false){ - // Get the contents and convert it to HTML - $content = MarkdownExtra::defaultTransform(file_get_contents($v)); + $post = new stdClass; + + // Replaced string + $replaced = substr($v, 0, strrpos($v, '/')) . '/'; + + // The static page URL + $url = str_replace($replaced,'',$v); + $post->url = site_url() . str_replace('.md','',$url); + + $post->file = $v; + + // Get the contents and convert it to HTML + $content = MarkdownExtra::defaultTransform(file_get_contents($v)); - // Extract the title and body - $arr = explode('t-->', $content); - if(isset($arr[1])) { - $post->title = str_replace('', $content); + if(isset($arr[1])) { + $post->title = str_replace('