SlideShare una empresa de Scribd logo
1 de 21
Drupal & AJAXThe New Way Presentedby David Corbacho Roman, DrupalSpecialist at Drupro May 28, 2009
AJAX Asynchronous Javascript and XML  Let’stalkabout ,[object Object]
jQuery’shigherlevelabstraction of AJAX.
Contrib module CTools, and the new D7 AJAX Framework in corethataffectsalsototheForm API (FAPI), replacingtheDrupal 6’s AHAH.,[object Object]
AJAX evolution Why Ctools? Demo!
Before AJAX
6 years of AJAX 2004- 2005 - 2006 – 2007 – 2008 - 2009 – 2010 Google beta apps ,[object Object]
Google Suggest
Google MapsWebsites behaving like desktop applications, thanks to the XMLHTTPRequest Object.
6 years of AJAX 2004 - 2005- 2006 – 2007 – 2008 - 2009 – 2010 Jesse James Garrett gives a name to this combination of tecnologies.
6 years of AJAX 2004 - 2005 - 2006– 2007 – 2008 - 2009 – 2010
6 years of AJAX 2004 - 2005 - 2006 – 2007– 2008 - 2009 – 2010 Drupal 6 released! Includes jQuery for the first time. NathanHaug – quicksketch – developes AHAH features
6 years of AJAX 2004 - 2005 - 2006 – 2007 – 2008- 2009 – 2010 CTools (Chaos Tools Suite) #26 byEarl Miles – merlinofchaos Low-level tools for developers           	Multi-step forms              Plugins   			Exportables 			… One of themisAJAX responder butunknown, undocumented ignored
6 years of AJAX 2004 - 2005 - 2006 – 2007 – 2008 - 2009– 2010 CTools’ AJAX Framework getsintoDrupal 7 core!
6 years of AJAX 2004 - 2005 - 2006 – 2007 – 2008 - 2009 – 2010
AJAX “old way” PHP Side JS Side  Output a link with a CSS id/class Bind the link. Make Ajaxcall Loading.. Callback functionthatreturns JSON/HTML Manage received data. Manipulate the DOM Handle AJAX errors Drupal.behaviors
AJAX “new way” PHP Side JS Side Output a link with .ctools-use-ajax (.use-ajax in D7) Bind the link. Make Ajaxcall Loading.. Use macro commands like: ctools_ajax_command_append ajax_command_append (in D7) Manage received data. Manipulate the DOM Handle AJAX errors Drupal.behaviors
Why use the “new way”? Adventages of beingpart of Drupalcore Standarizedway of doingAjax D7 ~ D6 Gracefuldegradation. Identifyingajaxlinks. Lesscodetowrite/maintain LetAjax Framework takescare of  Loading… Allthejavascript. Drupal.behaviors() Errorsdisplay WarmCache*
Let’s demo
<divclass="item-list">   <ul>      <liclass="first“>        <ahref="/dbox/drupro_demo_example/nojs/" class="ctools-use-ajax">Show Image</a>      </li>      <liclass="last">      <ahref="/dbox/drupro_demo_remove/nojs/" class="ctools-use-ajax“>Remove Image</a>      </li> </ul> </div> <divid="drupro-demo-area“>      </div>
URL   /drupro_demo_example/nojs function drupro_demo_example_ajax_response($js){    $output = '<img src=“/sites/all/modules/drupro_demo/drupro.png“ />';    if($js == 'ajax'){  ctools_include('ajax');        $commands = array();        $commands[] = ctools_ajax_command_html('#drupro-demo-area', $output);        ctools_ajax_render($commands);      }else{  // no javascript  return $output;      } }

Más contenido relacionado

Similar a Drupal & AJAX. Drupalcamp Finland 2010

Ajax: User Experience
Ajax: User ExperienceAjax: User Experience
Ajax: User Experience
petrov
 
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar TechnologiesRob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
george.james
 
Ajax Fundamentals Web Applications
Ajax Fundamentals Web ApplicationsAjax Fundamentals Web Applications
Ajax Fundamentals Web Applications
dominion
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
ronaldmam
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorial
Kat Roque
 

Similar a Drupal & AJAX. Drupalcamp Finland 2010 (20)

Copy of ajax tutorial
Copy of ajax tutorialCopy of ajax tutorial
Copy of ajax tutorial
 
Ajax
AjaxAjax
Ajax
 
M Ramya
M RamyaM Ramya
M Ramya
 
Ajax
AjaxAjax
Ajax
 
Ajax: User Experience
Ajax: User ExperienceAjax: User Experience
Ajax: User Experience
 
Pracitcal AJAX
Pracitcal AJAXPracitcal AJAX
Pracitcal AJAX
 
Ajax3
Ajax3Ajax3
Ajax3
 
HTML, Javascript and AJAX
HTML, Javascript and AJAXHTML, Javascript and AJAX
HTML, Javascript and AJAX
 
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar TechnologiesRob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
 
Ajax Fundamentals Web Applications
Ajax Fundamentals Web ApplicationsAjax Fundamentals Web Applications
Ajax Fundamentals Web Applications
 
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
 
Ajax
Ajax Ajax
Ajax
 
Ajax on drupal the right way - DrupalCamp Campinas, São Paulo, Brazil 2016
Ajax on drupal the right way - DrupalCamp Campinas, São Paulo, Brazil 2016Ajax on drupal the right way - DrupalCamp Campinas, São Paulo, Brazil 2016
Ajax on drupal the right way - DrupalCamp Campinas, São Paulo, Brazil 2016
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
 
Building Applications Using Ajax
Building Applications Using AjaxBuilding Applications Using Ajax
Building Applications Using Ajax
 
AJAX
AJAXAJAX
AJAX
 
Ajax
AjaxAjax
Ajax
 
25250716 seminar-on-ajax text
25250716 seminar-on-ajax text25250716 seminar-on-ajax text
25250716 seminar-on-ajax text
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorial
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
 

Último

Último (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Drupal & AJAX. Drupalcamp Finland 2010

  • 1. Drupal & AJAXThe New Way Presentedby David Corbacho Roman, DrupalSpecialist at Drupro May 28, 2009
  • 2.
  • 4.
  • 5. AJAX evolution Why Ctools? Demo!
  • 7.
  • 9. Google MapsWebsites behaving like desktop applications, thanks to the XMLHTTPRequest Object.
  • 10. 6 years of AJAX 2004 - 2005- 2006 – 2007 – 2008 - 2009 – 2010 Jesse James Garrett gives a name to this combination of tecnologies.
  • 11. 6 years of AJAX 2004 - 2005 - 2006– 2007 – 2008 - 2009 – 2010
  • 12. 6 years of AJAX 2004 - 2005 - 2006 – 2007– 2008 - 2009 – 2010 Drupal 6 released! Includes jQuery for the first time. NathanHaug – quicksketch – developes AHAH features
  • 13. 6 years of AJAX 2004 - 2005 - 2006 – 2007 – 2008- 2009 – 2010 CTools (Chaos Tools Suite) #26 byEarl Miles – merlinofchaos Low-level tools for developers Multi-step forms Plugins Exportables … One of themisAJAX responder butunknown, undocumented ignored
  • 14. 6 years of AJAX 2004 - 2005 - 2006 – 2007 – 2008 - 2009– 2010 CTools’ AJAX Framework getsintoDrupal 7 core!
  • 15. 6 years of AJAX 2004 - 2005 - 2006 – 2007 – 2008 - 2009 – 2010
  • 16. AJAX “old way” PHP Side JS Side Output a link with a CSS id/class Bind the link. Make Ajaxcall Loading.. Callback functionthatreturns JSON/HTML Manage received data. Manipulate the DOM Handle AJAX errors Drupal.behaviors
  • 17. AJAX “new way” PHP Side JS Side Output a link with .ctools-use-ajax (.use-ajax in D7) Bind the link. Make Ajaxcall Loading.. Use macro commands like: ctools_ajax_command_append ajax_command_append (in D7) Manage received data. Manipulate the DOM Handle AJAX errors Drupal.behaviors
  • 18. Why use the “new way”? Adventages of beingpart of Drupalcore Standarizedway of doingAjax D7 ~ D6 Gracefuldegradation. Identifyingajaxlinks. Lesscodetowrite/maintain LetAjax Framework takescare of Loading… Allthejavascript. Drupal.behaviors() Errorsdisplay WarmCache*
  • 20. <divclass="item-list"> <ul> <liclass="first“> <ahref="/dbox/drupro_demo_example/nojs/" class="ctools-use-ajax">Show Image</a> </li> <liclass="last"> <ahref="/dbox/drupro_demo_remove/nojs/" class="ctools-use-ajax“>Remove Image</a> </li> </ul> </div> <divid="drupro-demo-area“> </div>
  • 21. URL /drupro_demo_example/nojs function drupro_demo_example_ajax_response($js){ $output = '<img src=“/sites/all/modules/drupro_demo/drupro.png“ />';   if($js == 'ajax'){ ctools_include('ajax'); $commands = array(); $commands[] = ctools_ajax_command_html('#drupro-demo-area', $output); ctools_ajax_render($commands); }else{ // no javascript return $output; } }
  • 22. ctools_ajax_command_html replace prepend append after before remove changed css attr settings redirect reload submit
  • 23. More onwww.drupro.com Roger Sanchez material aboutCtools Modal http://zroger.com/node/30 http://zroger.com/node/31 SF 2010 Ajax / CTools http://sf2010.drupal.org/conference/sessions/ajax-and-javascript-drupal7-developers http://www.archive.org/search.php?query=drupalcon%20sf%20ajax http://sf2010.drupal.org/conference/sessions/leveraging-chaos-tool-suite-module-development http://www.chapterthree.com/blog/josh_koenig/ajaxmodal_functionality_0_lines_javascript_200_more_chaos_magic CTools Paris 2009 bymerlinofchaos http://www.archive.org/details/LearntousetheCToolssuite http://www.angrydonuts.com/ctools-presentation-slides-and-example-code Module Examples http://drupal.org/project/examples
  • 24. Thank you for your time!