04.02.2013 Views

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Note: If you drag the original includes folder out of the unzipped <strong>Spry</strong> folder, the demos in the <strong>Spry</strong> folder won’t work<br />

properly.<br />

5 In Code view (View > Code), link the <strong>Spry</strong> data library files to your web page by inserting the following script<br />

tags within the page’s head tag:<br />

<br />

<br />

The <strong>Spry</strong>Data.js file depends on the xpath.js file, so it’s important that the xpath.js file comes first in the code.<br />

When you’ve linked the <strong>Spry</strong> data library, you can create a <strong>Spry</strong> data set.<br />

6 Add the <strong>Spry</strong> name-space declaration to the HTML tag so that the HTML tag looks as follows:<br />

<br />

The <strong>Spry</strong> name space declaration is necessary to validate the code.<br />

Note: <strong>Spry</strong> features work locally as long as the <strong>Spry</strong> data library files are linked to your HTML page. To publish the<br />

HTML page to a live server, upload the xpath.js and <strong>Spry</strong>Data.js files as dependent files.<br />

Create a <strong>Spry</strong> XML data set<br />

1 Open a new or existing HTML page.<br />

2 Make sure that you’ve linked the <strong>Spry</strong> data library files to the page and declared the <strong>Spry</strong> namespace. For more<br />

information, see “Prepare your files” on page 110.<br />

3 Locate the XML source for the data set.<br />

For example, you might want to use an XML file called cafetownsend.xml located in a folder called data in the site’s<br />

root folder:<br />

data/cafetownsend.xml<br />

You could also specify a URL to an XML file, as follows:<br />

http://www.somesite.com/somefolder/cafetownsend.xml<br />

SPRY<br />

<strong>User</strong> <strong>Guide</strong><br />

Note: The URL you decide to use (whether absolute or relative) is subject to the browser’s security model, which means<br />

that you can only load data from an XML source that is on the same server domain as the HTML page you’re linking<br />

from. You can avoid this limitation by providing a cross-domain service script. For more information, consult your server<br />

administrator.<br />

4 Because you’ll need to specify the repeating XML node that supplies data to the data set, make sure you understand<br />

the structure of the XML before you create the data set.<br />

In the following example, the cafetownsend.xml file consists of a parent node called specials that contains a repeating<br />

child node called menu_item.<br />

111

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!