i have a view with bootstrap template which is embedded at my view/reportlist.php (localhost/Project/index.php). the problem is that every time i perform a CRUD, well codeigniter reroutes me to deffirent uri. example, when i edit a report from my list, i will be redirected to my view/reportlist.php (/Project/index.php/report/edit). then my bootstrap template is ruined. i need to go back to the /Project/index.php to load back everything up. please if you know, post some ideas, ive been like this for days now, i cant find a relevant answer.
Asked
Active
Viewed 7,301 times
-1
2 Answers
3
there is no relation between codeigniter route and bootstrap. you can set you default controller in line 41 in: application > config > route.php file.
on ther other hand you can set you base_url in line 17 in: application > config > config.php by this:
$config['base_url'] = "http://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= preg_replace('@/+$@','',dirname($_SERVER['SCRIPT_NAME'])).'/';
I'm sure that you have call again the list view in you edit method in report controller :D . if you want to avoid index.php from you url then you can modify code in your .htdocs files:
-
another thing is that the bootstrap template only loads on my default controller inside the index() function. other function inside (when executed) loads the same view as my index but doesnt load the template (css, js, etc) – Hard Spocker Apr 24 '14 at 08:13
-
i have tried your suggestions but it doesnt seem to change anything. – Hard Spocker Apr 24 '14 at 08:16
-
ok sir. i have here the default_controller index function: public function index() { $this->load->database(); $this->load->model('ReportModel'); if (isset($_POST['report'])) $reports=$this->ReportModel->search($_POST['report']); else $reports=$this->ReportModel->get_last_ten_entries(); $models=$this->ReportModel->getModel(); $this->load->view('report/reportlist',array('reports'=>$reports,'models'=>$models)); } – Hard Spocker Apr 24 '14 at 13:56
-
and here is my insert function also inside the default_controller: public function insert() { $this->load->database(); $this->load->model('ReportModel'); $this->ReportModel->insert_entry(); $reports=$this->ReportModel->get_last_ten_entries(); $this->load->view('report/reportlist',array('reports'=>$reports)); } although both functions (index and insert) loads the same view, only index gets the bootstrap template along with the .css and .jss files. while insert function looks very crappy. – Hard Spocker Apr 24 '14 at 13:59
-
"$this->load->view('report/reportlist',array('reports'=>$reports)); " -By this line in both function you are calling same view and that is why is show the same view file. and I think there is an error in the insert method when your are inserting data to datbase. so that your view file is not loaded properly. debug manually! thaks. – codekman May 15 '14 at 11:25
1
In your form action attribute specify a route: <?php echo base_url('/someRoute'); ?>
, and in routes.php
map it to some specific controller: $route['someRoute'] = 'home/someRoute';
, from this controller load your desired view.

Fven
- 547
- 3
- 5