Re: [symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-30 Thread DEEPAK BHATIA
You can use new plugins based on Jquery working similar to link_to_remote.. On Fri, Apr 30, 2010 at 7:36 PM, Massimiliano Arione garak...@gmail.comwrote: On 29 Apr, 15:36, Gareth McCumskey gmccums...@gmail.com wrote: I know you are talking about ajax. So, for the sake of brevity i include

[symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-29 Thread Massimiliano Arione
On 29 Apr, 09:17, Gareth McCumskey gmccums...@gmail.com wrote: Or return an array from the action to the template/partial and have php do: ul   ?php foreach ($array as $array_item): ?     li?php echo $array_item ?/li   ?php endforeach; ? /ul We're talking about ajax. You just can't output

Re: [symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-29 Thread Gareth McCumskey
I know you are talking about ajax. So, for the sake of brevity i include an example of the way it could be done in symfony 1.0 using the helpers: In a template: ?php echo link_to_remote('Link text', array( url=module/action, update=div_to_update )) ? div id='div_to_update'/div In

Re: [symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-29 Thread Paul Burdon
Thanks Both, no point in making things harder if symfony gives you the tools especially if javsacript is not a strong one which for me it isn't so i like the partial example, that was what I was after - understanding how to link the symfony elements together to make it nice and neat. Really

[symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-27 Thread Tofuwarrior
Ho Both, Thanks for your thoughts on this. If you can spare the time, I have one further question about this I am currently returning the ul that the tree menu function needs from the action which calls a fetchTree function which is currently in the model. This was just for development purposes

[symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-23 Thread Massimiliano Arione
On 21 Apr, 15:14, Paul Burdon p...@clearintent.co.uk wrote: Could you clarify what the 'proper' way is please. Thanks. Of course. The proper way is to write html as if javascript wouldn't exist. Then, write javascript files that use the document load event to look into dom, modify the dom

Re: [symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-23 Thread Gareth McCumskey
Massimiliano is right, but the right way or best paractices as it is known tends to be a moving goal post. When we started work on one of our large projects, embedded javascript (i.e. javascript on a link as an onClick event) wasn't seen as odd or strange. Now, its considered best practices to

[symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-21 Thread Massimiliano Arione
On 19 Apr, 16:46, Tofuwarrior psbur...@googlemail.com wrote: As a general principle is my approach ( ie pull the data from an action into the jQuery) correct. I don't think your approach is fully correct. You should never mix javascript and php code. You should write php (and so html) as if

Re: [symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-21 Thread Gareth McCumskey
Its not javascript code its just a JSON encoded string. On Wed, Apr 21, 2010 at 8:22 AM, Massimiliano Arione garak...@gmail.com wrote: On 19 Apr, 16:46, Tofuwarrior psbur...@googlemail.com wrote: As a general principle is my approach ( ie pull the data from an action into the jQuery) correct.

Re: [symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-21 Thread Paul Burdon
Thanks for all input everyone. Finally got it working, had to mess around with the javascript aswell and that is always tricky for someone who really has never gone very far with it. Anyway, it looks and works great, who would have thought that old dirty javascript would turn out to be such a

Re: [symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-21 Thread Alexandru-Emil Lupu
well i do: inside the controller: $this-hasLayout(false); inside the view: ?php echo json_encode($my_json_content_variable)? Alecs On Wed, Apr 21, 2010 at 2:51 PM, Paul Burdon p...@clearintent.co.uk wrote: Thanks for all input everyone. Finally got it working, had to mess around with the

Re: [symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-21 Thread Gareth McCumskey
And if you had to create a restful api that returns content as JSON? Returning JSON using renderText is perfectly valid and does not break the seperation of concerns. The actions responsibility is to recieve a request, gather data needed for the response and pass that data to the template and/or

[symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-21 Thread Massimiliano Arione
On 21 Apr, 14:39, Gareth McCumskey gmccums...@gmail.com wrote: And if you had to create a restful api that returns content as JSON? Returning JSON using renderText is perfectly valid and does not break the seperation of concerns. The actions responsibility is to recieve a request, gather data

Re: [symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-21 Thread Paul Burdon
Could you clarify what the 'proper' way is please. Thanks. On 21 April 2010 14:02, Massimiliano Arione garak...@gmail.com wrote: On 21 Apr, 14:39, Gareth McCumskey gmccums...@gmail.com wrote: And if you had to create a restful api that returns content as JSON? Returning JSON using

Re: [symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-20 Thread Gareth McCumskey
Its exactly the right approach so don't worry about that ;) On Mon, Apr 19, 2010 at 4:46 PM, Tofuwarrior psbur...@googlemail.com wrote: Thanks all, I knew about changing the template but not about the render text. I'm just off to try these things out now. Much appreciated. As a general

[symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-19 Thread Massimiliano Arione
On 19 Apr, 14:43, Tofuwarrior psbur...@googlemail.com wrote: I don't want a template, I just want to get the raw output of this action into this javascript function and I figure this is the problem. So, you replied yourself: just skip the view in your action. You can do it with return

[symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-19 Thread Tofuwarrior
Thanks all, I knew about changing the template but not about the render text. I'm just off to try these things out now. Much appreciated. As a general principle is my approach ( ie pull the data from an action into the jQuery) correct. Thanks, Paul On 19 Apr, 14:17, Gareth McCumskey

[symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-19 Thread Tofuwarrior
Hi all, So, some progress but still, not working and 2 seperate issues I think. 1) When I return renderText the output still been decorated by the debug toolbar. This is when i access /folder/tree/id/1 directly. - Is this because I am not calling this with jq_remote_function ?(I read somethign

[symfony-users] Re: :-( please help. ajax problem - noob to ajax -probably simple

2010-04-19 Thread Tofuwarrior
OK, I think I'm nearly there. If i use the bundled php connector for the treeMenu script it works fine so I know it works. $('#fileTreeDemo_1').fileTree({ root: '/', script: '/js/jqueryFileTree/ connectors/jqueryFileTree.php?id=.$CmsFolder-getId().' }, function(file) { BUT when I substitute my