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.

SPRY<br />

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

The value of this spry:test attribute can be any JavaScript expression that evaluates to zero or false or some<br />

nonzero value. If the expression returns a nonzero value, the content is output. Because you are using XHTML, any<br />

special characters like &, that might be used in a JavaScript expression need to be converted to HTML entities.<br />

YoucanalsousedatareferencesinsidethisJavaScriptexpressionandthedynamicregionprocessingengineprovides<br />

the actual values from a data set just before evaluating the spry:test expression.<br />

The following code shows the final output of the preceding example:<br />

<br />

<br />

<br />

<br />

Dynamic Region Example<br />

<br />

<br />

<br />

var dsPhotos = new <strong>Spry</strong>.Data.XMLDataSet("/photos.php?galleryid=2000",<br />

"/gallery/photos/photo");<br />

<br />

<br />

<br />

<br />

<br />

sun.jpg<br />

surf.jpg<br />

<br />

<br />

<br />

<br />

Conditional constructs<br />

Dynamic regions currently support two conditional constructs. The first is "spry:if". In the following example,<br />

the li tag is only written out if the value of {@path} begins with the letter s:<br />

131

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

Saved successfully!

Ooh no, something went wrong!