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 requesting service. JSON is just a data format (well
within the actions field of responsibilities) not Javascript.

On Wed, Apr 21, 2010 at 2:00 PM, Alexandru-Emil Lupu
<gang.al...@gmail.com> wrote:
> 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 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 useful thing :-)
>>
>>
>>
>> On 21 April 2010 07:58, Gareth McCumskey <gmccums...@gmail.com> wrote:
>>>
>>> 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.
>>> >
>>> > 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 javascript wouldn't exist.
>>> > Then, in a second step, add user interface enhancement with pure
>>> > javascript files.
>>> > It's a matter of separation of concerns: html (php) for structure, css
>>> > for presentation, javascript for behavior
>>> >
>>> > cheers
>>> > Massimiliano
>>> >
>>> > --
>>> > If you want to report a vulnerability issue on symfony, please send it
>>> > to security at symfony-project.com
>>> >
>>> > You received this message because you are subscribed to the Google
>>> > Groups "symfony users" group.
>>> > To post to this group, send email to symfony-users@googlegroups.com
>>> > To unsubscribe from this group, send email to
>>> > symfony-users+unsubscr...@googlegroups.com
>>> > For more options, visit this group at
>>> > http://groups.google.com/group/symfony-users?hl=en
>>> >
>>>
>>>
>>>
>>> --
>>> Gareth McCumskey
>>> http://garethmccumskey.blogspot.com
>>> twitter: @garethmcc
>>>
>>> --
>>> If you want to report a vulnerability issue on symfony, please send it to
>>> security at symfony-project.com
>>>
>>> You received this message because you are subscribed to the Google
>>> Groups "symfony users" group.
>>> To post to this group, send email to symfony-users@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> symfony-users+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/symfony-users?hl=en
>>
>> --
>> If you want to report a vulnerability issue on symfony, please send it to
>> security at symfony-project.com
>>
>> You received this message because you are subscribed to the Google
>> Groups "symfony users" group.
>> To post to this group, send email to symfony-users@googlegroups.com
>> To unsubscribe from this group, send email to
>> symfony-users+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-users?hl=en
>>
>
>
>
> --
> Have a nice day!
>
> Alecs
> Certified ScrumMaster
>
> There are no cannibals alive! I have ate the last one yesterday ...
> I am on web:  http://www.alecslupu.ro/
> I am on twitter: http://twitter.com/alecslupu
> I am on linkedIn: http://www.linkedin.com/in/alecslupu
> Tel: (+4)0722 621 280
>
> --
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to