Using YUI

To get started with YUI, visit the following URL to download the complete distribution to your hard disk, where you can work on it locally:

http://developer.yahoo.com/yui/download

The download is about 11 MB in size and is supplied as a ZIP file that you will need to decompress. Once this is done, you will have a folder with a name such as yui_2.7.0b, depending on the version downloaded, inside of which will be another folder simply called yui.

Navigate to this folder and load up the index.html file that you’ll find there into your browser to see a web page like that shown in Figure 19-1.

In the same directory where index.html resides, you’ll also see a number of others. In particular I’d like to point you in the direction of the build folder, which contains about 60 subfolders that hold all the framework scripts (see Figure 19-2). You can copy the ones you need from here directly to your website, or access the ones on Yahoo’s website by referencing http://yui.yahooapis.com/2.7.0/build/ followed by the folder and script name. (Without the latter two names, this URL will call up an error page.)

For example, you could copy the file yahoo.js from the build/yahoo folder to your website and link to it like this:

<script src="yahoo.js"></script>

Or you could link directly to Yahoo’s copy, like this:

<script src="http://yui.yahooapis.com/2.7.0/build/yahoo/yahoo.js"></script>
The YUI documentation main page
Figure 19-1. The ...

Get Learning PHP, MySQL, and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.