我很难用CodeIgniter制作多个页面。例如,我试图用CodeIgniter制作一个简单的关于页面。所以我创建了一个about.php控制器和一个about view.php视图文件。但是,如果我尝试从主页链接到“
http://miketrottman.com/about
“它不会去任何地方。我确信我从根本上错过了一些东西,但我已经阅读并观看了一些示例视频,我只是在这个项目上旋转我的轮子。这是我的home.php控制器,请告诉我是否应该发布其他代码。我的网站是
http://miketrottman.com
. 我是新来的编码器点火现场,任何帮助都是非常感谢!
控制器目录中的home.php
’
类Home扩展控制器{
function Home()
{
parent::Controller();
}
function index()
{
//Load Extensions
$this->load->database();
$this->load->library('session');
//Include these basics everytime the home page is loaded
$data['pageTitle'] = "Trottman's Blog";
$data['title'] = "Trottman's Blog Title";
$data['heading'] = "Trottman's Blog Heading";
//Load Proper CSS for users browser
$data['css'] = $this->getCSS();
//Load the Blog Model
$this->load->model('blog_model');
//Load the Blog Entries
$data['blog'] = $this->blog_model->getBlogEntries();
$data['blog_comments'] = $this->blog_model->getBlogCommentEntries();
//
//Load all of this information into the home_view Page
$this->load->view('home_view', $data);
}
function getCSS()
{
//Load user_agent library to pull user's browser information
$this->load->library('user_agent');
//Agent is now the users browser
$agent = $this->agent->browser();
//According to the users browser, this is what the CSS should be
if ($agent == 'Internet Explorer')
{
$cssFile = "ieStyle.css";
}
else
{
$cssFile = "style.css";
}
return $cssFile;
}
}?gt;
’