Home > Yii > AssetManager

AssetManager

private $_assetsUrl;
 
/**
 * protected/modules/admin/assets/images/logo.png befindet sich in deny from all
 * und wird nach webroot/assets/blablub/images/logo.png verfrachtet
 * @see http://www.yiiframework.com/doc/api/1.1/CAssetManager#publish-detail
 */
public function getAssetsUrl()
{
    if ($this->_assetsUrl === null) {
        $this->_assetsUrl = Yii::app()->getAssetManager()->publish(
            Yii::getPathOfAlias('admin.assets'), false, -1, YII_DEBUG
        );
    }
 
    return $this->_assetsUrl;
}

Zugriff dann im View wie folgt:

<?php echo CHtml::image($this->module->assetsUrl . '/images/logo.png'); ?>

ausführliche Info hier

Verwandte Artikel:

  1. famfamfam-icons als yii extension
  2. CButtonColumn erweitern
Author: Categories: Yii Tags:
  1. Bisher keine Kommentare
  1. Bisher keine Trackbacks