blob: 35eeb2dcf240aece7277ec6f56f4508a7c7aa890 [file] [log] [blame]
<?php
class Pelican extends CI_Controller {
private function is_valid_file($rel_path = '/', $file_html = 'home.html')
{
$abs_path = APPPATH.$rel_path.$file_html;
if (file_exists($abs_path))
return true;
return false;
}
public function index()
{
$this->load->view('index.html');
}
public function view($file_name = 'home')
{
$file_html = $file_name.'.html';
if ($this->is_valid_file('views/blog/', $file_html))
{
$this->load->view('blog/'.$file_html);
}
else if ($this->is_valid_file('views/category/', $file_html))
{
$this->load->view('category/'.$file_html);
}
else if ($this->is_valid_file('views/page/', $file_html))
{
$this->load->view('page/'.$file_html);
}
else if ($this->is_valid_file('views/', $file_html))
{
$this->load->view($file_html);
}
else
{
$this->index();
}
}
}