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 an example of  the way it could be done in symfony 1.0 using
  the helpers:

 symfony 1.0 is unsupported since a long time.
 Wonder why newer versions drop the ugly helpers like link_to_remote...

 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.comsymfony-users%2bunsubscr...@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


[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 any html anywhere, unless you want to use ugly
innerHTML js function.

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


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 actions.class.php

public function executeAction(sfWebRequest $request)
{
  //Run whatever model class methods to get data you need
  //and store that in an array eg:
  $this-array_to_use = ModelNamePeer::getDataArray();

  //Render to a partial
  $this-renderPartial('partialName');
}


Now in _partialName.php:

ul
  ?php foreach ($array_to_use as $array_item): ?
li?php echo $array_item ?/li
  ?php endforeach; ?
/ul

That partial would display within the div_to_update div in the
template and is ajax.

On Thu, Apr 29, 2010 at 3:27 PM, Massimiliano Arione garak...@gmail.com wrote:
 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 any html anywhere, unless you want to use ugly
 innerHTML js function.

 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


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 appreciate your insights.



On 29 April 2010 14:36, Gareth McCumskey gmccums...@gmail.com wrote:

 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 actions.class.php

 public function executeAction(sfWebRequest $request)
 {
  //Run whatever model class methods to get data you need
  //and store that in an array eg:
  $this-array_to_use = ModelNamePeer::getDataArray();

  //Render to a partial
  $this-renderPartial('partialName');
 }


 Now in _partialName.php:

 ul
  ?php foreach ($array_to_use as $array_item): ?
 li?php echo $array_item ?/li
  ?php endforeach; ?
 /ul

 That partial would display within the div_to_update div in the
 template and is ajax.

 On Thu, Apr 29, 2010 at 3:27 PM, Massimiliano Arione garak...@gmail.com
 wrote:
  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 any html anywhere, unless you want to use ugly
  innerHTML js function.
 
  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.comsymfony-users%2bunsubscr...@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.comsymfony-users%2bunsubscr...@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


[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 and I can see I
shouoldn't be writing html in the model -  I need to put it in the
appropriate place. The function grabs the child folders and child
files for the given parent and then writes the ul on this basis.

What is the best way to separate this out in symfony - do I need to
use a helper for this, maybe a partial? ( I don't yet fully understand
these and when they should be used. ) and then pass the child folders
and files to this which can output the html that is returned to the
ajax function ?

My assumption is that I should grab the child objects in the action by
calling peer methods, assign them as variables and then call something
that will take these values and output the ul which is then returned
by the action to the ajax.

Thanks,

Paul

-- 
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


[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 itself and add other events (that use ajax)

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


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 write Javascript that creates event listeners on dom
elements instead. When I first started web development, table-based
designs were the norm and taught at schools now CSS replaces that
logic and table based designs are seen (rightfully) as layout hacks.

My advice is just to try and keep clued up on this industry cos things
tend to move very quickly and development (web or desktop) is still
trying to find its feet and its best ways of doing things.
Ultimately, even if its development is ugly, your end users wont care
how its coded just that it works. Best practices are really only
there to make our lives as devs easier over the long term in assisting
us to write code thats easy to maintain and extend, hence the creation
of symfony 3

On Fri, Apr 23, 2010 at 6:59 PM, Massimiliano Arione garak...@gmail.com wrote:
 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 itself and add other events (that use ajax)

 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


[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 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


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.

 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


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 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.comsymfony-users%2bunsubscr...@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.comsymfony-users%2bunsubscr...@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


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 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


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 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


[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 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.

Of course, I didn't mean the json part when I spoke of separation.
That part is perfect, and after all is the only way to use ajax.
The wrong part is the use of jq_javascript_tag() helper, that
implies writing javascript code into html.

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


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 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.

 Of course, I didn't mean the json part when I spoke of separation.
 That part is perfect, and after all is the only way to use ajax.
 The wrong part is the use of jq_javascript_tag() helper, that
 implies writing javascript code into html.

 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.comsymfony-users%2bunsubscr...@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


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 principle is my approach ( ie pull the data from an
 action into the jQuery) correct.

 Thanks,

 Paul

 On 19 Apr, 14:17, Gareth McCumskey gmccums...@gmail.com wrote:
 In addition there are other things you can do too like tell it to use
 a different template to the one that it will automatically look for
 (great for re-using a template you've created before) by doing:

 $this-setTemplate('templatefilename'); //Note no return word in fron
 and no Success.php at the end of the template name

 You can also instruct an action to load a partial instead for those
 AJAX responses where you need content rendered:

 return $this-renderPartial('partialname', array('variable1'=$variable1));



 On Mon, Apr 19, 2010 at 2:43 PM, Tofuwarrior psbur...@googlemail.com wrote:
  Hi,

  If anyone can help me I would be very grateful, I'm over my head but I
  think it is probably a simple thing i'm missing. I've got this far
  using the jobeet tutorial and various jQuery and symfony resources but
  I'm stuck.

  I'm trying to get an ajax jQuery treeMenu to work in symfony and I
  think I might be lacking basic understanding about how to set it up in
  Symfony. I'm using 1.4 and have installed the jQueryReloaded plugin so
  no problems there.

  Currently I am doing this in the show template which is where the tree
  should show.
  ?php echo javascript_include_tag('/js/jqueryFileTree/
  jqueryFileTree') ;
  echo jq_javascript_tag(
  $(document).ready( function() {
                                 
  $('#fileTreeDemo_1').css('background-color','#999');
                                 $('#fileTreeDemo_1').fileTree({ root: '/', 
  script: '/folder/tree/
  id/.$CmsFolder-getId().' }, function(file) {
                                         alert(file);
                                 });

                         });

  );
  ?

  This calls the jquery file tree thing fine. By interrupting the
  process in the script I can see that the div gets updated with the
  loading image so that's not the problem but looking in firebug I can
  see that there is a 404 happening, it says: 
  POSThttp://www.domain.com/folder/tree/id/1
  . If I access this action (which is the one supposed to return the
  stuff for the ajax) I get a 500 error, no template found
  (treeSuccess.php).

  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.

  Just for reference.
  The tree menu script is  here:http://pastebin.com/R1yW0C9t

  Thanks for taking a look, I'm tearing my hair out!

  --
  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 McCumskeyhttp://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 
 athttp://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




-- 
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


[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 $this-renderText('your js stuff')

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


[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 gmccums...@gmail.com wrote:
 In addition there are other things you can do too like tell it to use
 a different template to the one that it will automatically look for
 (great for re-using a template you've created before) by doing:

 $this-setTemplate('templatefilename'); //Note no return word in fron
 and no Success.php at the end of the template name

 You can also instruct an action to load a partial instead for those
 AJAX responses where you need content rendered:

 return $this-renderPartial('partialname', array('variable1'=$variable1));



 On Mon, Apr 19, 2010 at 2:43 PM, Tofuwarrior psbur...@googlemail.com wrote:
  Hi,

  If anyone can help me I would be very grateful, I'm over my head but I
  think it is probably a simple thing i'm missing. I've got this far
  using the jobeet tutorial and various jQuery and symfony resources but
  I'm stuck.

  I'm trying to get an ajax jQuery treeMenu to work in symfony and I
  think I might be lacking basic understanding about how to set it up in
  Symfony. I'm using 1.4 and have installed the jQueryReloaded plugin so
  no problems there.

  Currently I am doing this in the show template which is where the tree
  should show.
  ?php echo javascript_include_tag('/js/jqueryFileTree/
  jqueryFileTree') ;
  echo jq_javascript_tag(
  $(document).ready( function() {
                                 
  $('#fileTreeDemo_1').css('background-color','#999');
                                 $('#fileTreeDemo_1').fileTree({ root: '/', 
  script: '/folder/tree/
  id/.$CmsFolder-getId().' }, function(file) {
                                         alert(file);
                                 });

                         });

  );
  ?

  This calls the jquery file tree thing fine. By interrupting the
  process in the script I can see that the div gets updated with the
  loading image so that's not the problem but looking in firebug I can
  see that there is a 404 happening, it says: 
  POSThttp://www.domain.com/folder/tree/id/1
  . If I access this action (which is the one supposed to return the
  stuff for the ajax) I get a 500 error, no template found
  (treeSuccess.php).

  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.

  Just for reference.
  The tree menu script is  here:http://pastebin.com/R1yW0C9t

  Thanks for taking a look, I'm tearing my hair out!

  --
  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 McCumskeyhttp://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 
 athttp://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


[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 about ajax calls being automatically detected by
symfony and so it bypassing decorating with debug toolbar etc.
I'm just doing this
echo jq_javascript_tag(
$(document).ready( function() {

$('#fileTreeDemo_1').css('background-color','#999');
$('#fileTreeDemo_1').fileTree({ root: '/', 
script: '/folder/tree/
id/.$CmsFolder-getId().' }, function(file) {
alert(file);
});

});

);

So will symfony still detect the xmlhttprequest status in the same
way.

2) When I call this url from the function firebug still shows JQuery
reporting receiving a 404 from the same url above that was accessed
fine directly  - ?!?!? Erm.

You guys/gals got any ideas on how I couold proceed?

Cheers,

Paul



On 19 Apr, 15:46, 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 principle is my approach ( ie pull the data from an
 action into the jQuery) correct.

 Thanks,

 Paul

 On 19 Apr, 14:17, Gareth McCumskey gmccums...@gmail.com wrote:



  In addition there are other things you can do too like tell it to use
  a different template to the one that it will automatically look for
  (great for re-using a template you've created before) by doing:

  $this-setTemplate('templatefilename'); //Note no return word in fron
  and no Success.php at the end of the template name

  You can also instruct an action to load a partial instead for those
  AJAX responses where you need content rendered:

  return $this-renderPartial('partialname', array('variable1'=$variable1));

  On Mon, Apr 19, 2010 at 2:43 PM, Tofuwarrior psbur...@googlemail.com 
  wrote:
   Hi,

   If anyone can help me I would be very grateful, I'm over my head but I
   think it is probably a simple thing i'm missing. I've got this far
   using the jobeet tutorial and various jQuery and symfony resources but
   I'm stuck.

   I'm trying to get an ajax jQuery treeMenu to work in symfony and I
   think I might be lacking basic understanding about how to set it up in
   Symfony. I'm using 1.4 and have installed the jQueryReloaded plugin so
   no problems there.

   Currently I am doing this in the show template which is where the tree
   should show.
   ?php echo javascript_include_tag('/js/jqueryFileTree/
   jqueryFileTree') ;
   echo jq_javascript_tag(
   $(document).ready( function() {
                                  
   $('#fileTreeDemo_1').css('background-color','#999');
                                  $('#fileTreeDemo_1').fileTree({ root: '/', 
   script: '/folder/tree/
   id/.$CmsFolder-getId().' }, function(file) {
                                          alert(file);
                                  });

                          });

   );
   ?

   This calls the jquery file tree thing fine. By interrupting the
   process in the script I can see that the div gets updated with the
   loading image so that's not the problem but looking in firebug I can
   see that there is a 404 happening, it says: 
   POSThttp://www.domain.com/folder/tree/id/1
   . If I access this action (which is the one supposed to return the
   stuff for the ajax) I get a 500 error, no template found
   (treeSuccess.php).

   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.

   Just for reference.
   The tree menu script is  here:http://pastebin.com/R1yW0C9t

   Thanks for taking a look, I'm tearing my hair out!

   --
   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 McCumskeyhttp://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 
  

[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 own
$('#fileTreeDemo_1').fileTree({ root: '/', script: '/folder/tree/id/.
$CmsFolder-getId().' }, function(file) {

 for the bundled one firebug shows a 404 error for that url.
I can access the url fine directly and it outputs the same format
ulliblah blah/li/ul as the bundled connector except
with the web debug attached to it but I presume that is because when i
access it directly xmlHttpRequest is false so symfony decorates it
with the debug stuff.

Anyone got any ideas of where to look?

Thanks,

TW

On 19 Apr, 15:46, 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 principle is my approach ( ie pull the data from an
 action into the jQuery) correct.

 Thanks,

 Paul

 On 19 Apr, 14:17, Gareth McCumskey gmccums...@gmail.com wrote:



  In addition there are other things you can do too like tell it to use
  a different template to the one that it will automatically look for
  (great for re-using a template you've created before) by doing:

  $this-setTemplate('templatefilename'); //Note no return word in fron
  and no Success.php at the end of the template name

  You can also instruct an action to load a partial instead for those
  AJAX responses where you need content rendered:

  return $this-renderPartial('partialname', array('variable1'=$variable1));

  On Mon, Apr 19, 2010 at 2:43 PM, Tofuwarrior psbur...@googlemail.com 
  wrote:
   Hi,

   If anyone can help me I would be very grateful, I'm over my head but I
   think it is probably a simple thing i'm missing. I've got this far
   using the jobeet tutorial and various jQuery and symfony resources but
   I'm stuck.

   I'm trying to get an ajax jQuery treeMenu to work in symfony and I
   think I might be lacking basic understanding about how to set it up in
   Symfony. I'm using 1.4 and have installed the jQueryReloaded plugin so
   no problems there.

   Currently I am doing this in the show template which is where the tree
   should show.
   ?php echo javascript_include_tag('/js/jqueryFileTree/
   jqueryFileTree') ;
   echo jq_javascript_tag(
   $(document).ready( function() {
                                  
   $('#fileTreeDemo_1').css('background-color','#999');
                                  $('#fileTreeDemo_1').fileTree({ root: '/', 
   script: '/folder/tree/
   id/.$CmsFolder-getId().' }, function(file) {
                                          alert(file);
                                  });

                          });

   );
   ?

   This calls the jquery file tree thing fine. By interrupting the
   process in the script I can see that the div gets updated with the
   loading image so that's not the problem but looking in firebug I can
   see that there is a 404 happening, it says: 
   POSThttp://www.domain.com/folder/tree/id/1
   . If I access this action (which is the one supposed to return the
   stuff for the ajax) I get a 500 error, no template found
   (treeSuccess.php).

   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.

   Just for reference.
   The tree menu script is  here:http://pastebin.com/R1yW0C9t

   Thanks for taking a look, I'm tearing my hair out!

   --
   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 McCumskeyhttp://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 
  athttp://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