Wednesday, July 12th, 2006
Adobe Spry and PHP/MySQL
Mike Kornienko took Adobe's Spry Framework for a spin.
He has written up his thoughts on integrating it with a PHP/MySQL backend:
Spry is Adobe's Ajax library for manipulating XML data. It has some very unique and pretty useful functions like regions handling, related auto-updating data and stuff like that. For example, you can load XML file into your HTML document, created a template-like markup for with some spry: tags in it, and Spry will do the rest - will read the XML file and output it into your web-page in the format you have defined. Not only that. You can have several connected data sets so that when you select a row in the main table generated by Spry, and if you have a region on your web-page which is somehow depends on selected row in main table, this region will be updated automatically.
The article shows the XML that you give to Spry, the libraries involved, and the HTML components:
-
-
<input type="button" value="sort id" onclick="dsTest.sort('id','toggle')""/>
-
<input type="button" value="sort title" onclick="dsTest.sort('title','toggle')""/>
-
<input type="button" value="sort content" onclick="dsTest.sort('content','toggle')""/>
-
-
<div spry:region="dsTest">
-
<table border="1">
-
<tr spry:repeat="dsTest">
-
<td>{@id}</td>
-
<td>{name}</td>
-
<td>{place}</td>
-
</tr>
-
</table>
-
</div>
-












Is it just me or is the post missing something?
Like the article link: http://macdiggs.com/index.php/2006/07/05/integration-of-spry-and-phpmysql/
:)
Although this library is convenient, it has a problem with validation. It embeds invalid markup into the HTML and relies on the *generated* html to create a valid page. If there’s content needed by a web crawler or something, it won’t show up (which can happen on ajax-instensive pages).
It’s interesting to note that even though the markup starts as invalid (acc. to the w3c validator), the generated HTML from javascript switches the browser back into standards-compliance mode instead of quirks mode.
I guess I would just prefer not to rely on embedding the invalid markup into the HTML and separate the behaviors from the data. Here’s a good article on it:
http://www.alistapart.com/articles/behavioralseparation
I would be interested to see a direct comparison between Spry and Zapatec, which we are also considering. It seems that Spry is stronger on XML data-binding, but Zapatec is better for generating forms. Zapatec has some interesting widgets such as a slider control and conditional form display. Unfortunately they are both quite big libraries, so I am not sure that we will be able to use both of them.