Welcome Guest, Not a member yet? Register   Sign In
Please help with $_GET['page']...
#1

[eluser]BoyBlue[/eluser]
I have this code working on a project outside of CI
(I had to replace href with *stuff* to get this to post)

Code in my *View* Page:

<ul class="navbar">
<li class="button"><a stuff="index.php">Home</a></li>
<li class="button"><a stuff="index.php?page=BlogPosts">Blog Posts</a></li>
<li class="button"><a stuff="index.php?page=Photos">Photos</a></li>
<li class="button"><a stuff="index.php?page=Issues">Issues</a></li>
</ul>



*Controller* page Code:

if($_GET['page'] == "BlogPosts"){
include("views/blogposts.php");


}else if($_GET['page'] == "Photos"){
include("views/photos.php");

}else if($_GET['page'] == "Issues"){
include("views/issues.php");

}else{

include("views/home.php");
}


****Now here is My failed attempt at CI:****

View Code:

<ul class="navbar">
<li class="button"><a stuff="index.php">Home</a></li>
<li class="button"><a stuff="index.php?page=BlogPosts">Blog Posts</a></li>
<li class="button"><a stuff="index.php?page=Photos">Photos</a></li>
<li class="button"><a stuff="index.php?page=Issues">Issues</a></li>
</ul>

Controller Code:

if ($this->input->get('page') == 'BlogPosts'){
$this->load->view('view_blog_posts');
}
elseif ($this->input->get('page') == 'Photos'){
$this->load->view('view_photos');
}
elseif ($this->input->get('page') == 'Issues'){
$this->load->view('view_issues');
}
else{

$this->load->view('view_home');

}


The error that I'm getting is *404 Page Not found*.

What am I doing wrong? Also, is there a better way to do this inside CI?

thx,
Ryan


Messages In This Thread
Please help with $_GET['page']... - by El Forum - 01-22-2011, 10:54 PM
Please help with $_GET['page']... - by El Forum - 01-23-2011, 12:32 AM
Please help with $_GET['page']... - by El Forum - 01-23-2011, 08:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB