Development

#272 (fast JSON / AJAX call with sfView::HEADER_ONLY avoiding template rendering)

You must first sign up to be able to contribute.

Ticket #272 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

fast JSON / AJAX call with sfView::HEADER_ONLY avoiding template rendering

Reported by: benoitm Assigned to:
Priority: minor Milestone: 0.6.3
Component: Version: 0.7.X
Keywords: Cc: yahoo@perenite.com
Qualification:

Description

Hello,

As a result from #252 and the last parapgraph of the wiki wiki:AjaxAndJSON I'm asking the best way to reduce the view call while doing AJAX/JSON actions. In this configuration rendering through a view is useless as just sending the X-JSON header is enough. So we can reduce execution time and avoid writting xxSuccess.php template for each AJAX/JSON call. I edited a patch I think is the "cleaner" let me know if we can improove it.

Thanks

patch for sfExecutionFilter.class.php:

114,120c114
<     if ($viewName == sfView::HEADER_ONLY){
<       $filterChain->executionFilterDone();
<
<       // execute next filter
<       $filterChain->execute();
<       }
<     else if ($viewName != sfView::NONE)
---
>     if ($viewName != sfView::NONE)

and in sfView.class.php:

44a45,49
>
>   /**
>    * skip view rendering, output header (fast JSON call)
>    */
>    const HEADER_ONLY = 'headerOnly';

This way we can have a very fast AJAX/response using the #252 enhancement. Thanks

Change History

03/04/06 12:37:53 changed by anonymous

  • priority changed from trivial to minor.

03/07/06 18:57:23 changed by anonymous

  • milestone changed from 0.6.1 to 0.6.2.

03/16/06 11:40:49 changed by anonymous

  • cc set to yahoo@perenite.com.

04/10/06 11:43:33 changed by fabien

  • milestone changed from 0.6.2 to 0.6.3.

04/28/06 12:24:50 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

r 1289.