Welcome Guest, Not a member yet? Register   Sign In
beginners routing problem
#1

[eluser]Unknown[/eluser]
Hello all, I've just started learning to use the framework and I'm following the tutorial here:

http://ie.mirror.twsweb-int.com/codeigni...ction.html

I have hit a very basic problem that I just can't figure out. I have a News controller class with an index method inside that is just supposed to load a view (for the moment) but when I point my browser to:

http://localhost/codeIgniter/index.php/news/index

I get a 404 page not found. I am running a local MAMP server and the CI welcome page showed up fine before I changed the routes file - now I can't even show that using the default url format - http://localhost/codeIgniter/index.php/welcome/index

Can anyone see what I am doing wrong?

Code:
<?php

class News extends CI_Controller {
  
  //constructor method
  public function __construct() {
   //run the CI_Controller constructor method too
   parent::__construct();
   //load the news model
   $this->load->model('news_model');
  }
  
  public function index() {
   //$data['news'] = $this->news_model->get_news();
   $data['title'] = 'news archive';
  
   $this->load->view('templates/header', $data);
   $this->load->view('news/index', $data);
   $this->load->view('templates/footer', $data);
  }
  
  public function view($id) {
   $data['news'] = $this->news_model->get_news($id);
   $data['title'] = 'news article';
  }
}

?>

routes:
Code:
$route['default_controller'] = "pages";
$route['(:any)'] = 'pages/view/$1';

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB