I've been playing with the AJAX support in Symfony this weekend and I'm blown away by how easy it is.
Today I put together a detailed/summary view switcher for a list of items coming from a database with a (script.aculo.us) fade in/out effect and I didn't need to write one line of JavaScript. Now that's what I'm talking about.
Here's a summary of what I did, with example code:
Everything applies to the 'list' action belonging to the 'bar' module. The view displays either detailed or summary view for a paginated list of records coming from the database.
In my view file (app/module/templates/listSuccess.php) I add:
[php][/php]
A quick reload and I can see that the libraries have been loaded:
[html]
[/html]
My complete template looks like:
[php]
<div style="border: 1px dashed #00F; height 100px;getAttribute('viewMode') == 'detail') ? “” : “display: none;”; ?>” id=”detail”>
Detail View
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed nulla augue, rhoncus in, ornare ac, vestibulum vitae, turpis. Suspendisse lacinia, odio at ornare suscipit, quam tellus dictum orci, eget egestas nibh sapien in enim. Nulla sed est nec lorem consectetuer adipiscing. Vivamus aliquam est ultricies ipsum. Duis et lacus. Nam venenatis sem sit amet justo. Donec pellentesque sodales felis. Nulla suscipit consequat arcu. Ut mollis turpis sit amet orci. Curabitur mauris massa, euismod eget, fringilla vel, interdum a, justo. Donec sed augue. Donec augue lacus, ullamcorper in, ultrices a, rhoncus sed, diam. Fusce nunc magna, porta eget, varius a, faucibus varius, est. Integer euismod dignissim mi. Aenean accumsan lectus non purus. Quisque ultrices sapien vitae sapien. Etiam tincidunt tellus et odio. Morbi pellentesque. Proin pharetra sem at massa.
Comments
2 responses to “Symfony and AJAX”
No link to an example page? Aarrggh!
Seriously though, I have bouncing back and forth about whether I should jump into the learning curve for CakePHP or Symfony for several projects on the horizon.
Something like this has me leaning toward Symfony.
[…] search was quickly and richly rewarded. I found lots of glowing references for the symfony framework. Symfony is so much more than what I was looking for, […]