Welcome Guest, Not a member yet? Register   Sign In
<Header> problem
#1

[eluser]dimis[/eluser]
I have this problem.
I have a controler and at constructor I set the view of the header
Code:
$this->data['header'] = $this->load->view('main/header', $this->data, TRUE);
At my function addcart I set
Code:
$this->data['myjs']="include js file";
And I write at header view
Code:
<?php echo $myjs ?>
But view do not print this variable .
What is wrong?
Maybe I have to initialize $this->data['myjs'] before header view but I want this script only at this function.
Is there a solution to write it at header?
#2

[eluser]beemr[/eluser]
For javascript, it is actually fastest to load it just before you close the body tag. Reason is that javascript hangs the socket until it is loaded and run. Fortunately for you, solving for speed should also solve your view ordering.




Theme © iAndrew 2016 - Forum software by © MyBB