SlideShare una empresa de Scribd logo
1 de 20
WE NEED TO TALK...
 Communication between
    PHP & jQuery
JQUERY

• Written   in Javascript

• jQuery   is just a library

   • Event   handling

   • DOM      Manipulation

   • Animation

   • AJAX
ASYNCHRONOUS DATA


• Data   on demand

• More   responsive app (for some situations)

• Decouple   presentation from data
XML vs. JSON vs. Plain Text vs. HTML



          Q: Which should you use!?

          A: It depends!
XML
            Pros                       Cons


                            • Bulky
• Easily   readable
                            • Notalways trivial to
• Efficient
                             parse
• Strict
                            • Can   be slow
HTML
             Pros                         Cons


                              • Bad   for data
• Simple
                              • Only   for presentation
• Great   for layout
                              • Hasto be rendered
• Flexible
                               every time
PLAIN TEXT
          Pros                           Cons


• Asreadable as you want      • No   semantics
 to make it
                              • What format is the
• Can   be anything            content?

• Can   be very fast          • No   context
JSON

                                     {
                                         "users":
                                            [
                                               {
                                                 "name":"Joey Joe Joe Junior Shabadoo",
                                                 "userId":"jjjjs",
                                                 "job":"A random guy at Moe's",


• JavaScript   Object Notation
                                                 "age":42
                                               },
                                               {
                                                  "name":"Mike Rowe",
                                                  "userId":"mrowe",
                                                  "job":"All Of Them",

• Collection   of name/value pairs
                                                  "age":48
                                               },
                                               {
                                                  "name":"Vincent Price",
                                                  "userId":"vprice",
                                                  "job":"Creepy Guy",

• Human   Readable
                                                  "age":82
                                               },
                                               {
                                                  "name":"Morgan Freeman",
                                                  "userId":"mfreeman",
                                                  "job":"God, President, Personal Driver, Inmate",
                                                  "age":78
                                               }
                                            ]
                                     }
JSON CONTINUED...
                  Pros                     Cons

• Super    fast

• Native   parsing in browser   • Not   quite as readable
• No   superfluous mark up       • Not as useful for
• Strict
                                 passing HTML

• Language        independent
JSON PARSING

• Always    use a parser!!!

• Never    user eval() – it’s not safe!

• $.parseJSON();     (jquery)     or      JSON.parse(); (native)

• Parsers   are faster than eval();

• In   PHP: json_decode();
JSON CREATION

• Never    generate JSON by hand

• Always   use a library!

• JSON    libs available for almost any language (json.org)

• Native   browser support: JSON.stringify();

• In   PHP: json_encode();
RETURN VALUES



• Always   return something from your back-end

• Better   to return an object rather than a random string (an
 array)
EXAMPLES!

• Form   processing

• Front-end   vs. back-end

• Templating

• Debugging

• http://github.com/gplocke/TriPUG-PHP-JS-Example
FORM PROCESSING


• Asynchronous    form processing

• Doesn’t   interrupt the user’s work flow

• Remember     to use only where appropriate
Robert Frost wasn’t a developer



• When  do you use PHP to build a
 view, when do you use JS
Let your front-end do some of the lifting


• HTML    can be created with PHP or JS

• The   HTML must be added to the DOM

• Use   JS for reusable / repeatable things

• Templating
JQUERY TEMPLATES

• Neat

• Simple

• Powerful

• Fast

• http://api.jquery.com/category/plugins/templates/
Back-End View Generation


• Complex    or extensive markup

• One-time   things

• Forms
DEBUGGING


• FireBug   + FirePHP (firephp.org)

• Only   for Firefox

• FirePHPCore    library or Zend Framework
THANKS!


Email: gplocke@gmail.com

Twitter: @gplocke

http://www.broken-notebook.com

Más contenido relacionado

La actualidad más candente

WordCamp 2012 - WordPress Webapps
WordCamp 2012 - WordPress WebappsWordCamp 2012 - WordPress Webapps
WordCamp 2012 - WordPress Webappstjasko
 
MongoDB Aug2010 SF Meetup
MongoDB Aug2010 SF MeetupMongoDB Aug2010 SF Meetup
MongoDB Aug2010 SF MeetupScott Hernandez
 
Building Your First MongoDB App ~ Metadata Catalog
Building Your First MongoDB App ~ Metadata CatalogBuilding Your First MongoDB App ~ Metadata Catalog
Building Your First MongoDB App ~ Metadata Cataloghungarianhc
 
Web Typography in Digital Publishing
Web Typography in Digital PublishingWeb Typography in Digital Publishing
Web Typography in Digital PublishingClare Evans
 
Turbo theming: Introduction to Sass & Compass
Turbo theming: Introduction to Sass & CompassTurbo theming: Introduction to Sass & Compass
Turbo theming: Introduction to Sass & CompassAlmog Baku
 
Building your first app with mongo db
Building your first app with mongo dbBuilding your first app with mongo db
Building your first app with mongo dbMongoDB
 
Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012hungarianhc
 

La actualidad más candente (7)

WordCamp 2012 - WordPress Webapps
WordCamp 2012 - WordPress WebappsWordCamp 2012 - WordPress Webapps
WordCamp 2012 - WordPress Webapps
 
MongoDB Aug2010 SF Meetup
MongoDB Aug2010 SF MeetupMongoDB Aug2010 SF Meetup
MongoDB Aug2010 SF Meetup
 
Building Your First MongoDB App ~ Metadata Catalog
Building Your First MongoDB App ~ Metadata CatalogBuilding Your First MongoDB App ~ Metadata Catalog
Building Your First MongoDB App ~ Metadata Catalog
 
Web Typography in Digital Publishing
Web Typography in Digital PublishingWeb Typography in Digital Publishing
Web Typography in Digital Publishing
 
Turbo theming: Introduction to Sass & Compass
Turbo theming: Introduction to Sass & CompassTurbo theming: Introduction to Sass & Compass
Turbo theming: Introduction to Sass & Compass
 
Building your first app with mongo db
Building your first app with mongo dbBuilding your first app with mongo db
Building your first app with mongo db
 
Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012
 

Similar a We Need To Talk: Communicating with PHP and jQuery

Lag Sucks! GDC 2012
Lag Sucks! GDC 2012Lag Sucks! GDC 2012
Lag Sucks! GDC 2012realjenius
 
Jolokia - JMX on Capsaicin (Devoxx 2011)
Jolokia - JMX on Capsaicin (Devoxx 2011)Jolokia - JMX on Capsaicin (Devoxx 2011)
Jolokia - JMX on Capsaicin (Devoxx 2011)roland.huss
 
Leaving jsps in the dust
Leaving jsps in the dustLeaving jsps in the dust
Leaving jsps in the dustVeena Basavaraj
 
Expert JavaScript Programming
Expert JavaScript ProgrammingExpert JavaScript Programming
Expert JavaScript ProgrammingYoshiki Shibukawa
 
Developing With Django
Developing With DjangoDeveloping With Django
Developing With DjangoDaniel Ryan
 
Game object models - Game Engine Architecture
Game object models - Game Engine ArchitectureGame object models - Game Engine Architecture
Game object models - Game Engine ArchitectureShawn Presser
 
Rapid Evolution of Web Dev? aka Talking About The Web
Rapid Evolution of Web Dev? aka Talking About The WebRapid Evolution of Web Dev? aka Talking About The Web
Rapid Evolution of Web Dev? aka Talking About The WebPINT Inc
 
CouchDB at JAOO Århus 2009
CouchDB at JAOO Århus 2009CouchDB at JAOO Århus 2009
CouchDB at JAOO Århus 2009Jason Davies
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDBMongoDB
 
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane EcosystemDownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane EcosystemFITC
 
Sharding with MongoDB -- MongoDC 2012
Sharding with MongoDB -- MongoDC 2012Sharding with MongoDB -- MongoDC 2012
Sharding with MongoDB -- MongoDC 2012Tyler Brock
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source BridgeChris Anderson
 
Thrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased ComparisonThrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased ComparisonIgor Anishchenko
 
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane EcosystemDownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane EcosystemFITC
 

Similar a We Need To Talk: Communicating with PHP and jQuery (20)

Mongo scaling
Mongo scalingMongo scaling
Mongo scaling
 
Lag Sucks! GDC 2012
Lag Sucks! GDC 2012Lag Sucks! GDC 2012
Lag Sucks! GDC 2012
 
mongoDB at Visibiz
mongoDB at VisibizmongoDB at Visibiz
mongoDB at Visibiz
 
Jolokia - JMX on Capsaicin (Devoxx 2011)
Jolokia - JMX on Capsaicin (Devoxx 2011)Jolokia - JMX on Capsaicin (Devoxx 2011)
Jolokia - JMX on Capsaicin (Devoxx 2011)
 
Google Protocol Buffers
Google Protocol BuffersGoogle Protocol Buffers
Google Protocol Buffers
 
Leaving jsps in the dust
Leaving jsps in the dustLeaving jsps in the dust
Leaving jsps in the dust
 
Expert JavaScript Programming
Expert JavaScript ProgrammingExpert JavaScript Programming
Expert JavaScript Programming
 
Developing With Django
Developing With DjangoDeveloping With Django
Developing With Django
 
Game object models - Game Engine Architecture
Game object models - Game Engine ArchitectureGame object models - Game Engine Architecture
Game object models - Game Engine Architecture
 
Rapid Evolution of Web Dev? aka Talking About The Web
Rapid Evolution of Web Dev? aka Talking About The WebRapid Evolution of Web Dev? aka Talking About The Web
Rapid Evolution of Web Dev? aka Talking About The Web
 
CouchDB at JAOO Århus 2009
CouchDB at JAOO Århus 2009CouchDB at JAOO Århus 2009
CouchDB at JAOO Århus 2009
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDB
 
Rc173 010d-json 2
Rc173 010d-json 2Rc173 010d-json 2
Rc173 010d-json 2
 
Couchdb Nosql
Couchdb NosqlCouchdb Nosql
Couchdb Nosql
 
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane EcosystemDownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
 
Sharding with MongoDB -- MongoDC 2012
Sharding with MongoDB -- MongoDC 2012Sharding with MongoDB -- MongoDC 2012
Sharding with MongoDB -- MongoDC 2012
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source Bridge
 
CouchDB introduction
CouchDB introductionCouchDB introduction
CouchDB introduction
 
Thrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased ComparisonThrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased Comparison
 
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane EcosystemDownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
 

Último

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 

Último (20)

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 

We Need To Talk: Communicating with PHP and jQuery

  • 1. WE NEED TO TALK... Communication between PHP & jQuery
  • 2. JQUERY • Written in Javascript • jQuery is just a library • Event handling • DOM Manipulation • Animation • AJAX
  • 3. ASYNCHRONOUS DATA • Data on demand • More responsive app (for some situations) • Decouple presentation from data
  • 4. XML vs. JSON vs. Plain Text vs. HTML Q: Which should you use!? A: It depends!
  • 5. XML Pros Cons • Bulky • Easily readable • Notalways trivial to • Efficient parse • Strict • Can be slow
  • 6. HTML Pros Cons • Bad for data • Simple • Only for presentation • Great for layout • Hasto be rendered • Flexible every time
  • 7. PLAIN TEXT Pros Cons • Asreadable as you want • No semantics to make it • What format is the • Can be anything content? • Can be very fast • No context
  • 8. JSON { "users": [ { "name":"Joey Joe Joe Junior Shabadoo", "userId":"jjjjs", "job":"A random guy at Moe's", • JavaScript Object Notation "age":42 }, { "name":"Mike Rowe", "userId":"mrowe", "job":"All Of Them", • Collection of name/value pairs "age":48 }, { "name":"Vincent Price", "userId":"vprice", "job":"Creepy Guy", • Human Readable "age":82 }, { "name":"Morgan Freeman", "userId":"mfreeman", "job":"God, President, Personal Driver, Inmate", "age":78 } ] }
  • 9. JSON CONTINUED... Pros Cons • Super fast • Native parsing in browser • Not quite as readable • No superfluous mark up • Not as useful for • Strict passing HTML • Language independent
  • 10. JSON PARSING • Always use a parser!!! • Never user eval() – it’s not safe! • $.parseJSON(); (jquery) or JSON.parse(); (native) • Parsers are faster than eval(); • In PHP: json_decode();
  • 11. JSON CREATION • Never generate JSON by hand • Always use a library! • JSON libs available for almost any language (json.org) • Native browser support: JSON.stringify(); • In PHP: json_encode();
  • 12. RETURN VALUES • Always return something from your back-end • Better to return an object rather than a random string (an array)
  • 13. EXAMPLES! • Form processing • Front-end vs. back-end • Templating • Debugging • http://github.com/gplocke/TriPUG-PHP-JS-Example
  • 14. FORM PROCESSING • Asynchronous form processing • Doesn’t interrupt the user’s work flow • Remember to use only where appropriate
  • 15. Robert Frost wasn’t a developer • When do you use PHP to build a view, when do you use JS
  • 16. Let your front-end do some of the lifting • HTML can be created with PHP or JS • The HTML must be added to the DOM • Use JS for reusable / repeatable things • Templating
  • 17. JQUERY TEMPLATES • Neat • Simple • Powerful • Fast • http://api.jquery.com/category/plugins/templates/
  • 18. Back-End View Generation • Complex or extensive markup • One-time things • Forms
  • 19. DEBUGGING • FireBug + FirePHP (firephp.org) • Only for Firefox • FirePHPCore library or Zend Framework

Notas del editor

  1. - great for things you don’t really care about (log messages)
  2. - code example
  3. - “The Road Not Taken.” He could only take one. We get to take both!
  4. - code example
  5. - code example