Agreed; It's pretty simple to output any format you like, and JSON would be lightening fast to output based on a collection of rows. XML would become useful if you're looking to provide an API based on your existing RESTful set of actions.
Much of the process that we have been talking about are often repeated between modules, and this would make a great plugin. The only variables that really need to be customised are the query, the pager, and the filters. CaMason On Jan 14, 12:29 pm, Lee Bolding <[email protected]> wrote: > Good idea, but JSON is way better when dealing with AJAX than XML. > > VALID XML is expensive to create (compared to JSON), and a real PITA > to parse in JS. JS frameworks like JQuery make it dead simple to use > JSON, and within your action all you need to do is : > > return $this->renderText(json_encode($resultset)); > > simple :) > > On 13 Jan 2009, at 22:41, CaMason wrote: > > > > > Most spiders will easily recognise that the page is 1) dynamic, and 2) > > already visited. > > > If you're worried about DOS attacks, you may want to look at server > > filtering rather than application level nofollows. > > > As gandalfu said, there's no need to store anything in the session, > > although you could do to save the sorting order if the user leaves > > this particular action cycle. > > > Here's a tip... create a module using the admin generator, then take a > > look at the generated code in the cache. The admin generated code > > already does pretty-much what you are looking for. In your template, > > check the pager object to see which column is being sorted, and in > > which direction. > > > A simple IF and SWITCH would work quite easily, Here's some > > pseudocode: > > > if($pager's sort column === current column) > > { > > switch ($pager's sort direction){ > > case: asc then echo descending link_to > > case: desc then echo reset link_to > > default: then echo ascending link_to > > }case, > > } else { > > echo ascending link_to; > > } > > > Put that in a partial, and pass the partial the current column header > > to be rendered. Check out the admin-generate modules for a nice way to > > handle query generation and sorting generation (and also, filter > > generation). > > > Also, then add the XML output for this, and you can attach nifty ajax > > based table sorts ontop of your standard HTML sorts. > > > That gives you best-practice. HTML output that allows sorting, XML > > output that can be sorted / filtered, and AJAX functionality attached > > to that. > > > Good luck! > > > On Jan 13, 11:13 am, Lee Bolding <[email protected]> wrote: > >> On 13 Jan 2009, at 10:49, [email protected] wrote: > > >>> There is no need to store anything on the user session. > > >>> Since you are reloading the page, you can regenerate the > >>> parameters yo > >>> pass when the user clics the header. first time you clic a header, > >>> you > >>> reload the page and add a (ASC) next to the label, next time a DESC, > >>> next time nothing.... and the correct urls parameters. > > >> True, but using a session may save you from a DOS attack when a > >> spider > >> reaches the site... unless you also add nofollow links to each > >> generated URL. > > >> Either way would work fine. Each has their own set of pro's and > >> con's. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
