![]() |
run the app in $route['default_controller'] - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: run the app in $route['default_controller'] (/showthread.php?tid=59095) |
run the app in $route['default_controller'] - El Forum - 08-23-2013 [eluser]Unknown[/eluser] I am doing an app but I want the app to run entirely in localhos/site I can make one page to work there, if i click a link it doesnt work. for example the app works if I use this route localhost/site/index.php/regions/List_page It doesnt go to list_page if I get like this localhost/site/regions/List_page this is the route $route['regions/List_page'] = 'regions/List_page'; $route['default_controller'] = 'regions'; the controller class Regions extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('Region_model'); } public function index() { $data['region'] = $this->Region_model->get_regions(); $this->load->view('template/header'); $this->load->view('regions/index',$data); $this->load->view('template/footer'); } public function List_page() { $data['region'] = $this->Region_model->get_regions(); $this->load->view('template/header'); $this->load->view('regions/List_page',$data); $this->load->view('template/footer'); } the model class Region_model extends CI_Model { public function __construct() { $this->load->database(); } public function get_regions() { $query = $this->db->get('region'); return $query->result_array(); } } the viewer <?php $region_name = $this->Region_model->UniqueField($region,'region'); print_r($region_name); ?> <?php for ($count=0; $count <=count($region_name)-1 ; $count++) { ?> <p><a href="regions/List_page/<?php echo $region_name[$count] ?>"> <?php echo $region_name[$count]; ?> </a></p> <!-- /<?php echo $region_name[$count] ?> --> <?php } ?> |