registerJsFile($jsfile . static::Clear(), [AppAsset::className(), "depends" => "frontend\assets\AppAsset"]); } /** * @param $view * @param $jsfile */ public static function addCss($view, $jsfile) { $view->registerCssFile($jsfile . static::Clear(), [AppAsset::className(), "depends" => "frontend\assets\AppAsset"]); } /** * @param \yii\web\View $view */ public function registerAssetFiles($view) { $manager = $view->getAssetManager(); foreach ($this->js as $js) { if (is_array($js)) { $file = array_shift($js); $options = ArrayHelper::merge($this->jsOptions, $js); $view->registerJsFile($manager->getAssetUrl($this, $file), $options); } else { if ($js !== null) { $view->registerJsFile($manager->getAssetUrl($this, $js . static::Clear()), $this->jsOptions); } } } foreach ($this->css as $css) { if (is_array($css)) { $file = array_shift($css); $options = ArrayHelper::merge($this->cssOptions, $css); $view->registerCssFile($manager->getAssetUrl($this, $file), $options); } else { if ($css !== null) { $view->registerCssFile($manager->getAssetUrl($this, $css . static::Clear()), $this->cssOptions); } } } } /** * @return string */ public static function Clear() { $cache = Yii::$app->cache; $name = Yii::$app->params['resourceCacheKey']['mobile']; $con = $cache->get($name); if ($con != false) { return '?v=' . $con; } else { return '?v=11111111'; } } }