[eluser]BaRzO[/eluser]
Hi all,
I am having a problem with my code.
My controller.
Code:
<?php
class Welcome extends Controller {
var $settings;
function Welcome() {
parent::Controller();
$this->load->database();
$this->load->library('theme_lib');
$this->load->helper('url');
}
function index() {
$this->theme_lib->_add_js("/* js comment */"); // this works
for ($i=0; $i<=5; $i++) {
$this->theme_lib->_add_js("/* js comment */"); // does not work
}
}
}
and my theme_lib
Code:
<?php
class Theme_lib {
var $CI;
var $_embed_js = '';
function Theme_lib() {
$this->CI = & get_instance();
log_message('debug', __CLASS__ . " Class Initialized");
}
function _add_js($js, $type = 'embed') {
if ($type == 'embed') {
$this->_embed_js .= $js . "\n";
} else {
$this->_js[] = $js;
}
}
}
Why this _add_js function does not work in for or foreach loops ?
Pls Help...
Thnks.