O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

symfony & jQuery (phpDay)

2.014 visualizações

Publicada em

Publicada em: Tecnologia
  • ★★ How Long Does She Want You to Last? ★★ A recent study proved that the average man lasts just 2-5 minutes in bed (during intercourse). The study also showed that many women need at least 7-10 minutes of intercourse to reach "The Big O" - and, worse still... 30% of women never get there during intercourse. Clearly, most men are NOT fulfilling there women's needs in bed. Now, as I've said many times - how long you can last is no guarantee of being a GREAT LOVER. But, not being able to last 20, 30 minutes or more, is definitely a sign that you're not going to "set your woman's world on fire" between the sheets. Question is: "What can you do to last longer?" Well, one of the best recommendations I can give you today is to read THIS report. In it, you'll discover a detailed guide to an Ancient Taoist Thrusting Technique that can help any man to last much longer in bed. I can vouch 100% for the technique because my husband has been using it for years :) Here's the link to the report ★★★ https://tinyurl.com/rockhardxxx
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui

symfony & jQuery (phpDay)

  1. 1. symfony & jQuery ties and separations Massimiliano Arione May, 14th 2011
  2. 2. About me <ul><ul><li>2001 PHP </li></ul></ul><ul><ul><li>2004 PEAR </li></ul></ul><ul><ul><li>2007 symfony </li></ul></ul><ul><ul><li>2009 agile </li></ul></ul>
  3. 3. symfony
  4. 4. jQuery
  5. 5. MVC
  6. 6. CPB
  7. 7. B ehavior <ul><ul><li>progressive enhancement </li></ul></ul><ul><ul><li>AJAX </li></ul></ul>
  8. 8. PROGRESSIVE ENHANCEMENT: THE WRONG WAY <ul><li>sfFormExtraPlugin : </li></ul><ul><ul><li>sfWidgetFormJQueryDate </li></ul></ul><ul><ul><li>sfWidgetFormJQueryAutocompleter </li></ul></ul><ul><ul><li>sfWidgetFormTextareaTinyMCE </li></ul></ul>
  9. 9. PROGRESSIVE   ENHACEMENT: THE GOOD WAY Just use plain Javascript!
  10. 10. AJAX: THE 4 STEPS <ul><ul><li>Javascript catches an interaction with user, or with other browser events </li></ul></ul><ul><ul><li>an XMLHttpRequest object send a request to server, without breaking the flow </li></ul></ul><ul><ul><li>an XML (or other format) is returned by server </li></ul></ul><ul><ul><li>Javascript decodes data from file and interacts with page </li></ul></ul>
  11. 11. AJAX: THE 4 STEPS <ul><ul><li>Javascript catches an interaction with user, or with other browser events </li></ul></ul><ul><ul><li>an XMLHttpRequest object send a request to server, without breaking the flow </li></ul></ul><ul><ul><li>an XML (or other format) is returned by server </li></ul></ul><ul><ul><li>Javascript decodes data from file and interacts with page </li></ul></ul>
  12. 12. AJAX: THE 4 STEPS <ul><ul><li>Javascript catches an interaction with user, or with other browser events </li></ul></ul><ul><ul><li>an XMLHttpRequest object send a request to server, without breaking the flow </li></ul></ul><ul><ul><li>an XML (or other format) is returned by server </li></ul></ul><ul><ul><li>Javascript decodes data from file and interacts with page </li></ul></ul>
  13. 13. AJAX: THE 4 STEPS <ul><ul><li>Javascript catches an interaction with user, or with other browser events </li></ul></ul><ul><ul><li>an XMLHttpRequest object send a request to server, without breaking the flow </li></ul></ul><ul><ul><li>an XML (or other format) is returned by server </li></ul></ul><ul><ul><li>Javascript decodes data from file and interacts with page </li></ul></ul>
  14. 14. AJAX: THE WRONG WAY sf 1.0: Javascript helper sf 1.4: sfJqueryPlugin <?php echo link_to_remote ('...'); echo jq_link_to_remote ('...');
  15. 15. AJAX: THE GOOD WAY <ul><ul><li>code as if Javascript wouldn't exist </li></ul></ul><ul><ul><li>write your jQuery functions in the big $().ready() function </li></ul></ul><ul><ul><li>do little adaptions to your controller </li></ul></ul><ul><ul><li>write another view (tipically a JSON one) </li></ul></ul>
  16. 16. AJAX: THE GOOD WAY <ul><ul><li>code as if Javascript wouldn't exist </li></ul></ul><ul><ul><li>write your jQuery functions in the big $().ready() function </li></ul></ul><ul><ul><li>do little adaptions to your controller </li></ul></ul><ul><ul><li>write another view (tipically a JSON one) </li></ul></ul>
  17. 17. AJAX: THE GOOD WAY <ul><ul><li>code as if Javascript wouldn't exist </li></ul></ul><ul><ul><li>write your jQuery functions in the big $().ready() function </li></ul></ul><ul><ul><li>do little adaptions to your controller </li></ul></ul><ul><ul><li>write another view (tipically a JSON one) </li></ul></ul>
  18. 18. AJAX: THE GOOD WAY <ul><ul><li>code as if Javascript wouldn't exist </li></ul></ul><ul><ul><li>write your jQuery functions in the big $().ready() function </li></ul></ul><ul><ul><li>do little adaptions to your controller </li></ul></ul><ul><ul><li>write another view (tipically a JSON one) </li></ul></ul>
  19. 19. IN PRACTICE: LINK <?php // in the view echo link_to (' + ', ' cart_increase ', $item) $(' div#cart a.increase ').click(ajaxIncrease);
  20. 20. var ajaxIncrease = function (e) {   $.ajax({     url:     this.href + ' ?sf_format=json ',     success: function (r) { increase(r, e.target); }   });   return false ; }; var increase = function (result, a) {   var $span = $(a).parents(' li ').find(' span.qty ');   var newqty = parseInt($span.text(), 10 ) + 1 ;   $span.empty().append(newqty);   $(' span#total ').empty();   $(' span#total ').append(result.total); };
  21. 21. <?php // in the view // cartIncreaseSuccess.json.php use_helper(' Number ');   $arr = array(   ' total ' => format_currency($sf_user->getCartTotal(), ' EUR '), ); echo json_encode($arr);
  22. 22. <?php // in the controller // actions.class.php public function executeCartIncrease(sfWebRequest $request) {   $this->product = $this->getRoute()->getProduct();   $this->getUser()->cartIncrease($this->product);   // was $this->redirect('@homepage');     $this->redirectUnless($request->isXmlHttpRequest(), ' @homepage '); }
  23. 23. IN PRACTICE: FORM $(' div#filters form ').submit(ajaxFilter);
  24. 24. var ajaxFilter = function(e) {   var $form = $(this);   $.ajax({     type: ' POST ',     url:  $form.attr(' action ') + ' ?sf_format=json ',     data: $form.serializeArray(),     success: showProducts   });   return false ; };
  25. 25. Thanks! Massimiliano Arione @ garakkio blog.garak.it github.com/garak/sfjqec joind.in/talk/view/3034

×