Welcome Guest, Not a member yet? Register   Sign In
Header is loaded at the end
#1

Hello,

recently I found a very weird issue when I load the header, the content and the footer from the controller. My code is this:

Code:
public function index( $item_index = NULL )
       {
               $data = array();
               ...
               GET SOME DATA FROM THE MODEL
               ...
               $this->load->view('layout/header.php',$data);
               $this->load->view('bootstrap/main.php', $data);
               $this->load->view('layout/footer.php', $data);
       }


The data from the model has no issue, is retrieved normally. But when I try to load the view, I get
ReferenceError: $ is not defined
basically because the jQuery script, and the whole header, is loaded at the very end of the page, after the footer.

Another strange thing is that this behavior happens in some environments. In this case, I found the issue when a put the code in a VM in AWS but also in a colleague local environment. But in my environment, with exactly the same code, it works perfectly.

I have tried everything, and the only solution is to copy the header and footer code directly into main.php and remove them from the controller.

Any other ideas?

Thanks a lot in advance.
Reply


Messages In This Thread
Header is loaded at the end - by Datenshi - 10-30-2018, 08:45 AM
RE: Header is loaded at the end - by dave friend - 10-30-2018, 10:51 AM
RE: Header is loaded at the end - by php_rocs - 10-30-2018, 05:30 PM
RE: Header is loaded at the end - by Pertti - 10-31-2018, 02:48 AM
RE: Header is loaded at the end - by InsiteFX - 10-31-2018, 03:07 AM
RE: Header is loaded at the end - by Datenshi - 10-31-2018, 07:54 PM
RE: Header is loaded at the end - by garimapatil - 02-06-2019, 12:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB