Hi! I need an help to improve a widget published few minutes ago: I need to automatic publish a folder from my extension to images folder. Can anyone help me?

This can be done in your init() or run() method for example:


It will copy the specified dir / files to assets.

As for the docs:

Yes yes: this copy ‘path/to/dir’ in assets folder. I need to copy ‘path/to/dir’ in /images folder.

Asset manager is not intended for this. Why would you copy them to images, instead of assets? Any reusable component should use assets. Publish returns the URL, so you can use that instead of your reference to images.

because I’ve create this widget:

Lightbox is a script that manipulate the DOM. It generate HTML code like this:

        //  <div id="overlay"></div>

        //  <div id="lightbox">

        //      <div id="outerImageContainer">

        //          <div id="imageContainer">

        //              <img id="lightboxImage">

        //              <div style="" id="hoverNav">

        //                  <a href="#" id="prevLink"></a>

        //                  <a href="#" id="nextLink"></a>

        //              </div>

        //              <div id="loading">

        //                  <a href="#" id="loadingLink">

        //                      <img src="images/loading.gif">

        //                  </a>

        //              </div>

        //          </div>

        //      </div>

        //      <div id="imageDataContainer">

        //          <div id="imageData">

        //              <div id="imageDetails">

        //                  <span id="caption"></span>

        //                  <span id="numberDisplay"></span>

        //              </div>

        //              <div id="bottomNav">

        //                  <a href="#" id="bottomNavClose">

        //                      <img src="images/close.gif">

        //                  </a>

        //              </div>

        //          </div>

        //      </div>

        //  </div>

I need assets folder position to get images. In instructions I say to copy a folder out from extension into /images folder. It work but I think it will be better improve my widget. I want to make lyiightbox usable with any manual operation. If can help me, can suggest me the way?

You should take a look at the CGridView widget that ships with Yii, as it can be compared. It includes JS, CSS and images. Instead of using the images directly, it uses CSS classes which in turn points to the correct images. This works well with assets, as the CSS file + images are published to the same folder, so a CSS rule can simply be as follows:



	background:url(loading.gif) no-repeat;