Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

The Asset "" To Be Published Does Not Exist Error While Registering The Js File

$
0
0
Hi,
I would like to include a js file inside my module('modules/emp/assets') and published it at
protected/components/Controller.php.
private $_assetsBase;
	
	public function getAssetsBase()
	{
		if ($this->_assetsBase === null) {
			$this->_assetsBase = Yii::app()->assetManager->publish(
					Yii::getPathOfAlias('application.assets'),
					false,
					-1,
					YII_DEBUG
			);
		}
		return $this->_assetsBase;
	}

While registering the js in the view its throwing error.
Yii::app()->clientScript->registerCssFile(Yii::app()->controller->assetsBase.'/js/jquery.js')
echo Yii::app()->controller->assetsBase;

Error as "The asset "" to be published does not exist. "

Viewing all articles
Browse latest Browse all 18717

Trending Articles