Hello I just started working with CodeIgniter framework. My current directory structure is
Demo(Project name)
+System
+Application
-Controllers
de
The $data variable sometimes may be lost if you have nested views and you don't pass it as an argument to the children/nested views.
I found a simple solution that is working very smoothly to me:
In your current view file you setup your script like this:
$this->scripts[] = '/js/myscript.js';
at your footer or {whatever.php} file you insert this code:
scripts))
foreach($this->scripts as $script) :
?>
If you need only a pice of javascript code, you can always use anonymous functions like this:
RenderScript[] = function() {
?>
}?>
and at the bottom:
RenderScript))
foreach($this->RenderScript as $script) {
$script();
}
?>