Welcome Guest, Not a member yet? Register   Sign In
contents of php file shows in browser window
#6

[eluser]TWP Marketing[/eluser]
May not be related, but you are loading three views in your controller:
Code:
...
public function index()
{
  $this->load->model('Database_construct');
  $this->load->view('top');
  $this->load->view('middle');
  $this->load->view('end');
}
..
These will overwrite each other and the server will be confused, or only one of them will be displayed by the browser.
If you have sub-views (top,middle,end) then you need a template to display them:
a template view file (/application/views/somename.php)
Code:
<html>
<head>
... html head code goes here
</head>
<body>
<?php
echo $top_view;
echo $middle_view;
echo $end_view
?>
</body>
</html>
In your controller, write the sub-views to variables using the second parameter (boolean true) of the loader view function:
[EDIT] See the User Guide: http://ellislab.com/codeigniter/user-gui...oader.html for the format of the load->view() method
Code:
...
public function index()
{
  $this->load->model('Database_construct');

  // we assume that you use your model functions here to prepare data for the views


  $data['top_view'] = $this->load->view('top',true); // write the html code to a data var
  $data['middle_view'] = $this->load->view('middle',true); // write the html code to a data var
  $data['end_view'] = $this->load->view('end',true); // write the html code to a data var

   // finally, send your template view to the browser and pass the array $data to that view for display
  $this->load->view('somename',$data); // this is the only view that goes to the browser
}
..


Messages In This Thread
contents of php file shows in browser window - by El Forum - 10-16-2012, 12:08 PM
contents of php file shows in browser window - by El Forum - 10-16-2012, 12:18 PM
contents of php file shows in browser window - by El Forum - 10-16-2012, 12:24 PM
contents of php file shows in browser window - by El Forum - 10-16-2012, 12:24 PM
contents of php file shows in browser window - by El Forum - 10-16-2012, 12:27 PM
contents of php file shows in browser window - by El Forum - 10-16-2012, 12:48 PM
contents of php file shows in browser window - by El Forum - 10-16-2012, 12:57 PM
contents of php file shows in browser window - by El Forum - 10-16-2012, 01:00 PM
contents of php file shows in browser window - by El Forum - 10-16-2012, 01:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB