[symfony-users] 1 action , 2 templates

2010-11-03 Thread Parijat Kalia
Hey guys,

I have 2 very identical templates which have only a minor difference to
them. Their action is exactly the same. So instead of retyping code or
wasting precious space (LOL), here is what my genius conjours:

private function privateAction()
{
 // do some amazing coding
}

public function executeMyAction1()
{
   $this-privateAction();
}


public function executeMyAction2()
{
   $this-privateAction();
}

So basically, I redefined the common action as a private action. Is this a
fine strategy? Or do we have a better recommended strategy!

-- 
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] 1 action , 2 templates

2010-11-03 Thread Martin Ibarra Cervantes
you can use partitials for the view

and in the acction pass the myvar


include_partitial('name', array('myvar'=$myvar));


On Wed, Nov 3, 2010 at 1:29 PM, Parijat Kalia kaliapari...@gmail.com wrote:
 Hey guys,
 I have 2 very identical templates which have only a minor difference to
 them. Their action is exactly the same. So instead of retyping code or
 wasting precious space (LOL), here is what my genius conjours:
 private function privateAction()
 {
  // do some amazing coding
 }
 public function executeMyAction1()
 {
    $this-privateAction();
 }

 public function executeMyAction2()
 {
    $this-privateAction();
 }
 So basically, I redefined the common action as a private action. Is this a
 fine strategy? Or do we have a better recommended strategy!



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


Re: [symfony-users] 1 action , 2 templates

2010-11-03 Thread Gareth McCumskey
Erm .. why not just use the same action instead of having two actions that
are exactly the same? If you are not sure what I mean please give me an
example of what you are doing and I can explain better, but you don't need
to create seperate actions if they are exactly the same

On Wed, Nov 3, 2010 at 10:33 PM, Martin Ibarra Cervantes 
ibarra.cervan...@gmail.com wrote:

 you can use partitials for the view

 and in the acction pass the myvar


 include_partitial('name', array('myvar'=$myvar));


 On Wed, Nov 3, 2010 at 1:29 PM, Parijat Kalia kaliapari...@gmail.com
 wrote:
  Hey guys,
  I have 2 very identical templates which have only a minor difference to
  them. Their action is exactly the same. So instead of retyping code or
  wasting precious space (LOL), here is what my genius conjours:
  private function privateAction()
  {
   // do some amazing coding
  }
  public function executeMyAction1()
  {
 $this-privateAction();
  }
 
  public function executeMyAction2()
  {
 $this-privateAction();
  }
  So basically, I redefined the common action as a private action. Is this
 a
  fine strategy? Or do we have a better recommended strategy!
 
 
 
  --
  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.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.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] 1 action , 2 templates

2010-11-03 Thread Alexandre Salomé
There's a setTemplate method on controller. Find the best between
setTemplate and include_partial for your case

Le 3 nov. 2010 21:46, Gareth McCumskey gmccums...@gmail.com a écrit :

Erm .. why not just use the same action instead of having two actions that
are exactly the same? If you are not sure what I mean please give me an
example of what you are doing and I can explain better, but you don't need
to create seperate actions if they are exactly the same



On Wed, Nov 3, 2010 at 10:33 PM, Martin Ibarra Cervantes 
ibarra.cervan...@gmail.com wrote:

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

-- 
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] 1 action , 2 templates

2010-11-03 Thread Alex Pilon
I think both ways are fine..

On Wed, Nov 3, 2010 at 16:33, Martin Ibarra Cervantes 
ibarra.cervan...@gmail.com wrote:

 you can use partitials for the view

 and in the acction pass the myvar


 include_partitial('name', array('myvar'=$myvar));


 On Wed, Nov 3, 2010 at 1:29 PM, Parijat Kalia kaliapari...@gmail.com
 wrote:
  Hey guys,
  I have 2 very identical templates which have only a minor difference to
  them. Their action is exactly the same. So instead of retyping code or
  wasting precious space (LOL), here is what my genius conjours:
  private function privateAction()
  {
   // do some amazing coding
  }
  public function executeMyAction1()
  {
 $this-privateAction();
  }
 
  public function executeMyAction2()
  {
 $this-privateAction();
  }
  So basically, I redefined the common action as a private action. Is this
 a
  fine strategy? Or do we have a better recommended strategy!
 
 
 
  --
  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.comsymfony-users%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en




-- 
Alex Pilon
(613) 608-1480

-- 
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] 1 action , 2 templates

2010-11-03 Thread Sebastien Armand [Pink]
Huh

If it's only a minor difference in the templates, you probably don't really
need 2 templates and could just pass a variable to the template so that from
there you know how you should display it...

On Thu, Nov 4, 2010 at 4:38 AM, Alex Pilon alex.pi...@gmail.com wrote:

 I think both ways are fine..


 On Wed, Nov 3, 2010 at 16:33, Martin Ibarra Cervantes 
 ibarra.cervan...@gmail.com wrote:

 you can use partitials for the view

 and in the acction pass the myvar


 include_partitial('name', array('myvar'=$myvar));


 On Wed, Nov 3, 2010 at 1:29 PM, Parijat Kalia kaliapari...@gmail.com
 wrote:
  Hey guys,
  I have 2 very identical templates which have only a minor difference to
  them. Their action is exactly the same. So instead of retyping code or
  wasting precious space (LOL), here is what my genius conjours:
  private function privateAction()
  {
   // do some amazing coding
  }
  public function executeMyAction1()
  {
 $this-privateAction();
  }
 
  public function executeMyAction2()
  {
 $this-privateAction();
  }
  So basically, I redefined the common action as a private action. Is this
 a
  fine strategy? Or do we have a better recommended strategy!
 
 
 
  --
  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.comsymfony-users%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en




 --
 Alex Pilon
 (613) 608-1480

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