symfony, AJAX
and me you
Dave Dash
Spindrop LLC
Minneapolis USA
Dave Dash // Spindrop.us // 2007 September 7
* Beginner’s track: Ajax + symfony
* Who’s used symfony/other frameworks/ajax? Who’s a novice?
* Who can tell us what Ajax is?
* AJAX makes web pages more responsive by exchanging small amounts of data with server behind the scenes
* interactions are recorded quickly
* AJAX is secretly DRY (=
you at yo eat y peat ep
urs ours your
rse
don lf. do elf. d elf. s
on’ don’
’t re n’t
rep pea repe t rep t
you eat yo t y at y eat
our
rse urs our
don lf. do elf. d self. self
D RY
on’ don’ .
’t re n’t
rep
eat peat repea t rep t rep
you you t yo eat y
you
rse
lf. d rself. rself urse ou
don don . don lf. do
’t re on’t
rep
eat peat repea ’t rep ’t rep n
you you t yo eat y eat
you
rse
lf. d rself. rself urse ours
don don . don lf. do el
’t re on’t
rep pea repe ’t rep ’t re n’t r
you eat yo t y eat peat e
at y
urs ours
rse our you you
lf. d elf. elf.
don self
don don . do rself.
on’
rep ’t rep t re do
’t re ’t r n’t
eat pea
eat pea epea repe
you t yo
you t yo t yo at
rse urs
rse
lf. d elf. ursel urse
lf. d
you on’ lf
don f. d
on’
rse t re ’t re on’t
t re
lf. d pea pea pea r
on’
t re t you t you t yo
* coders don’t repeat self, we use DRY, we make functions to do work that’s been done already
pea rsel u
rse
* server should be no different, why re-serve content again. Just sent what needs updating
* how revolutionary!
t yo f. do lf. do
* AJAX instrumental to my introduction to symfony
* 2 years ago Gmaps API caught my attention
urs n’t
elf. rep
e
As easy as riding a bike
* Google Maps API
* I started biking (not like Amsterdam in Minneapolis)
* Bike Routing over Google Maps
* AJAX interactions to retrieve/set the route coordinates
* Soon, digg posted a tutorial about creating a digg like interactions using a PHP framework
* creating a digg like interactions
* This was my gateway to the askeet tutorial for symfony and I was sold immediately
* AJAX has been around a while
* Gmail, g-apps made it very popular, pushed envelope
* Open to a whole new world
* Digg meaningless w/o AJAX
* 849 people aren’t going to wait for a form to submit
* Cope with info-overload.
* Many articles to digg!
* Increase in responsiveness/usability opens door to new features/apps
* star-raters
* getting a perspective into web2.0 users mind
* web apps > collection of database driven modules/actions
* each page fully featured interactive tools
* pull/push data as needed
* Francois suggested we can turn pages into static and using AJAX to populate the dynamic parts
* Questions?
Steps
symfony and AJAX
* AJAX manually = slow
* sf bundled with Prototype/Script.aculo.us
* helpers?
* helpers make AJAX in symfony easier
* coding consistent = no JS required
* AJAX Javascript Helpers in symfony mostly work in four steps
* There is an object
* It has an event
* The event triggers an AJAX call
* The response usually replaces the content of a target div.
* There's plenty of useful variations on this theme pattern
DEMO!
* Everything so far relies on Prototype and Script.aculo.us
* Some of us don’t like being boxed in.
boxed in?
* symfony does not box you in.
* helpers, bundling libs are great
* prototype/script.aculo.us no for everyone
* jQuery, YUI (like Dustin in the other talk), mooTools, dojo
* lots of good libraries, more than one way to
* sf is decoupled, dependencies are minimal if any.
* even the ORM swappable
* As for using other libraries, you can find plugins to do your job, and if none exist Fabien tomorrow
will show you how to write your own.
* all it takes is writing a helper and bundling the library and you can be prototype free in no time.
* Don't go home thinking you have to learn proto/scrip
* any more questions, or demos?