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 Experiencepetrov
 
Pracitcal AJAX
Pracitcal AJAXPracitcal AJAX
Pracitcal AJAXjherr
 
HTML, Javascript and AJAX
HTML, Javascript and AJAXHTML, Javascript and AJAX
HTML, Javascript and AJAXWan Leung Wong
 
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 Technologiesgeorge.james
 
Ajax Fundamentals Web Applications
Ajax Fundamentals Web ApplicationsAjax Fundamentals Web Applications
Ajax Fundamentals Web Applicationsdominion
 
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5Sadaaki HIRAI
 
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 2016Nicolás Bouhid
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentationronaldmam
 
Building Applications Using Ajax
Building Applications Using AjaxBuilding Applications Using Ajax
Building Applications Using Ajaxs_pradeep
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorialKat 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

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
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)wesley chun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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.pdfsudhanshuwaghmare1
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Último (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
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)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

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!