Welcome Guest, Not a member yet? Register   Sign In
run the app in $route['default_controller']
#1

[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++) { ?&gt;

<p><a href="regions/List_page/&lt;?php echo $region_name[$count] ?&gt;"> &lt;?php echo $region_name[$count]; ?&gt; </a></p>
&lt;!-- /&lt;?php echo $region_name[$count] ?&gt; --&gt;
&lt;?php } ?&gt;






Theme © iAndrew 2016 - Forum software by © MyBB