xxii/views/layouts/main.php<link rel="stylesheet" type="text/css" href="<?php echo $this->module->assetsUrl; ?>/css/main.css"/> ... <div id="logo"> <?php echo CHtml::link( CHtml::image($this->module->assetsUrl.'/images/logo.png'), array('/xxii')); ?> </div> ~~~ The first time this is used in an application, the asset manager copies all the files to the `webroot/assets/` folder, and then the module can use the `$model->assetsUrl` property to form the base of generated URLs for each of the particular resource files. Using the example assets layout shown in the earlier section, these two uses would generate the URLs: * `/assets/2472c2df/css/main.css` * `/assets/2472c2df/images/logo.png` respectively. Maintenance of the `assets` folder ---------------------------------- Many newcomers ask: "What do we do with the assets folder?", and the answer is "Mostly nothing". * It's important that the directory be writable by the webserver user so that Yii can publish the resources there when needed. * When a project has multiple versions (production, testing, development, etc.) **do not** copy the `assets/` folders from one area to another; allow Yii to deploy them automatically in each area. * **Do not** manually edit any file under `assets/` - if you have a real need to make a change, find the publishing module, edit the source, delete the subfolder under `assets/`, and let Yii re-publish the updated files. * **Do not** reference names under the `assets/` folder directly (say, to get at some other module's assets). If you need to use that * **Do not** add the contents of the `assets/` folder to any source-code control system; these files have master source in other places. Upgrading Yii ------------- The upgrade instructions to every new release of Yii include the note: - Clean up your 'assets' folder. This means to **delete** the contents of this folder (but leave the folder itself behind): Yii will re-deploy these assets from the new versions the first time each one is used. This step is important! Yii only publishes the resource files if the target unique-name folder does not exist, so if they're not removed during an upgrade, then the new version of the code will use old versions of asset files: this probably matters.