04.02.2013 Views

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<br />

<br />

<br />

Hijax Demo - Notes 1<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Note 1<br />

Note 2<br />

Note 3<br />

<br />

This is some static content for note 1.<br />

<br />

<br />

<br />

The Spy code added in the preceding code looks familiar, but you’ll notice that the div block that includes the<br />

spry:detailregion attribute also includes a spry:content attribute. This spry:content attributetellsthe<strong>Spry</strong><br />

dynamic-region processing code to replace the static data, currently contained in the region, with the data represented<br />

by the data reference in its attribute value, if any data is in the data set that the region is bound to.<br />

SPRY<br />

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

If this page is loaded in a browser with JavaScript disabled, it degrades and you get the same functionality as for the<br />

original page with static content and traditional link navigation. If JavaScript is enabled, the data set loads the XML<br />

data and replaces the static content in the region. Clicking the links updates the region with code from the data set.<br />

In the preceding example, Hijax promotes the use of unobtrusively attaching event handlers to links. The preceding<br />

example intentionally uses onclick attributes to quickly illustrate the point of attaching a JavaScript event handler.<br />

Building dynamic pages with <strong>Spry</strong><br />

Prepare your files<br />

Before you begin creating <strong>Spry</strong> data sets, obtain the necessary files (xpath.js and <strong>Spry</strong>Data.js). The xpath.js file allows<br />

you to specify complex XPath expressions when creating your data set; the <strong>Spry</strong>Data.js file contains the <strong>Spry</strong> data<br />

library.<br />

Link both files to whatever HTML page you’re creating.<br />

1 Locate the <strong>Spry</strong> ZIP file on the <strong>Adobe</strong> Labs website.<br />

2 Download and unzip the <strong>Spry</strong> ZIP file to your hard drive.<br />

3 Open the unzipped <strong>Spry</strong> folder and locate the includes folder. This folder contains the xpath.js and <strong>Spry</strong>Data.js<br />

files necessary for running the <strong>Spry</strong> framework.<br />

4 Copy the includes folder and either paste or drag a copy of it to the root directory of your web site.<br />

110

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

Saved successfully!

Ooh no, something went wrong!