Hi all,
I need some help about module, I try to load assets on my init module like this :
class MyModule extends CWebModule
{
protected $_excludeJs = false;
public function init()
{
if ($this->_excludeJs == false) {
// Load all JS for this module
}
}
public function anotherFunction()
{
// Do some stuff
}
public function noJS()
{
$this->_excludeJs = true;
return $this;
}
}
And when I run Yii::app()->getModule(‘my’), it’ll automatically load all needed JS for this module and this is okay. But the problem is I want to skip the JS when I want to run another function that doesn’t need JS like “anotherFunction”, so I try with chaining function like this :
Yii::app()->getModule('my')->noJS()->anotherFunction();
but It still load the JS, maybe it because I put register script in init() function, is there is any way to do this?
Thanks.