Different Php, Undefined Property

Hi.

I’ve a module inside my Yii app which uses the following, inside the theme’s main.php:


                foreach ($jsFiles as $filename) {

                    Yii::app()->getClientScript()->registerScriptFile(

                        $this->module->assetsUrl.DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR.$filename);

                }   



On my dev pc, with php 5.4.6, works like a charm.

On my production server, with php 5.3.19, the same file results in the following:

$this->module is undefined.

What could it be?

I’m using Yii 1.1.12, obviously on both hosts.

thanks

Hmm,

Your code is a bit scary

Why not:


$assetUrl = $this->module->assetsUrl;

$assetUrl .= DIRECTORY_SEPARATOR . 'js' .DIRECTORY_SEPARATOR;


foreach ($jsFiles as $filename) {

   Yii::app()->getClientScript()->registerScriptFile($assetUrl . $filename);

}

Having it organized ths way you can at least test your code and verify where is the error coming from!

thanks for the advice.

anyway I solved my problem, it was another bug leading to misloading some other code.