Re: What to use (Component? Helper?) for methods used in both controller and view

2009-12-02 Thread mark_story
Another approach is to do neither.  You can create classes that are
not direct MVC bits and use them.  Like jonas said the core Inflector
and Set classes are excellent examples of non MVC utility classes.

-Mark

On Dec 2, 6:40 am, "j0n4s.h4rtm...@googlemail.com"
 wrote:
> a.) Write both, Component and Helper, try to wrap Component methods
> from your helper.
> b.) Look at the Set:: or Inflector:: class, what they extend, where
> they are in core cake, how they get loaded while a cake app runs -
> implement it similar!
> c.) Whatever you do, most likely (there are exceptions, see Inflector
> or Set or Sanitize) you are doing it wrong and there is ONE domain
> that fits BEST (be it controller or view domain of MVC)
>
> King regards
>  Jonas/ionas82
>
> On Dec 2, 11:54 am, euromark  wrote:
>
>
>
> > i usually put them into components
>
> > as components can easily be added in helpers/views as well with
> > App::import()
>
> > otherwise around it usually aint that clean (html markup etc in the
> > helper?)
> > so better this way
>
> > a) you dont have bootstrap functions you only need once or twice
> > b) you dont have redundancy
> > c) your code stays clean structured
>
> > On 1 Dez., 20:20, drbuzasi  wrote:
>
> > > Good idea! Thanks!
> > > I wanted to use a helper but as i wrote 
> > > inhttp://groups.google.com/group/cake-php/browse_thread/thread/a65a11c3...
> > > controllers don't load helpers into class variables.
> > > I give it a try.
>
> > > On dec. 1, 18:48, Miles J  wrote:
>
> > > > If they are just stand alone functions that dont need to be in either
> > > > a component or a helper, just place the function in your bootstrap
> > > > file.
>
> > > > On Dec 1, 5:56 am, drbuzasi  wrote:
>
> > > > > Hi!
> > > > > I have some methods for several tasks that i need not only in
> > > > > controllers or in views but in both of them. There are helpers for
> > > > > views and components for controllers. Which of theese would be a
> > > > > better idea to share my logics. Or is there a third way to do this?
> > > > > Looking forward for any help from you
> > > > > Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: What to use (Component? Helper?) for methods used in both controller and view

2009-12-02 Thread j0n4s.h4rtm...@googlemail.com
a.) Write both, Component and Helper, try to wrap Component methods
from your helper.
b.) Look at the Set:: or Inflector:: class, what they extend, where
they are in core cake, how they get loaded while a cake app runs -
implement it similar!
c.) Whatever you do, most likely (there are exceptions, see Inflector
or Set or Sanitize) you are doing it wrong and there is ONE domain
that fits BEST (be it controller or view domain of MVC)

King regards
 Jonas/ionas82

On Dec 2, 11:54 am, euromark  wrote:
> i usually put them into components
>
> as components can easily be added in helpers/views as well with
> App::import()
>
> otherwise around it usually aint that clean (html markup etc in the
> helper?)
> so better this way
>
> a) you dont have bootstrap functions you only need once or twice
> b) you dont have redundancy
> c) your code stays clean structured
>
> On 1 Dez., 20:20, drbuzasi  wrote:
>
> > Good idea! Thanks!
> > I wanted to use a helper but as i wrote 
> > inhttp://groups.google.com/group/cake-php/browse_thread/thread/a65a11c3...
> > controllers don't load helpers into class variables.
> > I give it a try.
>
> > On dec. 1, 18:48, Miles J  wrote:
>
> > > If they are just stand alone functions that dont need to be in either
> > > a component or a helper, just place the function in your bootstrap
> > > file.
>
> > > On Dec 1, 5:56 am, drbuzasi  wrote:
>
> > > > Hi!
> > > > I have some methods for several tasks that i need not only in
> > > > controllers or in views but in both of them. There are helpers for
> > > > views and components for controllers. Which of theese would be a
> > > > better idea to share my logics. Or is there a third way to do this?
> > > > Looking forward for any help from you
> > > > Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: What to use (Component? Helper?) for methods used in both controller and view

2009-12-02 Thread euromark
i usually put them into components

as components can easily be added in helpers/views as well with
App::import()

otherwise around it usually aint that clean (html markup etc in the
helper?)
so better this way

a) you dont have bootstrap functions you only need once or twice
b) you dont have redundancy
c) your code stays clean structured


On 1 Dez., 20:20, drbuzasi  wrote:
> Good idea! Thanks!
> I wanted to use a helper but as i wrote 
> inhttp://groups.google.com/group/cake-php/browse_thread/thread/a65a11c3...
> controllers don't load helpers into class variables.
> I give it a try.
>
> On dec. 1, 18:48, Miles J  wrote:
>
> > If they are just stand alone functions that dont need to be in either
> > a component or a helper, just place the function in your bootstrap
> > file.
>
> > On Dec 1, 5:56 am, drbuzasi  wrote:
>
> > > Hi!
> > > I have some methods for several tasks that i need not only in
> > > controllers or in views but in both of them. There are helpers for
> > > views and components for controllers. Which of theese would be a
> > > better idea to share my logics. Or is there a third way to do this?
> > > Looking forward for any help from you
> > > Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: What to use (Component? Helper?) for methods used in both controller and view

2009-12-01 Thread drbuzasi
Good idea! Thanks!
I wanted to use a helper but as i wrote in
http://groups.google.com/group/cake-php/browse_thread/thread/a65a11c3a39e6f49#
controllers don't load helpers into class variables.
I give it a try.

On dec. 1, 18:48, Miles J  wrote:
> If they are just stand alone functions that dont need to be in either
> a component or a helper, just place the function in your bootstrap
> file.
>
> On Dec 1, 5:56 am, drbuzasi  wrote:
>
> > Hi!
> > I have some methods for several tasks that i need not only in
> > controllers or in views but in both of them. There are helpers for
> > views and components for controllers. Which of theese would be a
> > better idea to share my logics. Or is there a third way to do this?
> > Looking forward for any help from you
> > Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: What to use (Component? Helper?) for methods used in both controller and view

2009-12-01 Thread Miles J
If they are just stand alone functions that dont need to be in either
a component or a helper, just place the function in your bootstrap
file.

On Dec 1, 5:56 am, drbuzasi  wrote:
> Hi!
> I have some methods for several tasks that i need not only in
> controllers or in views but in both of them. There are helpers for
> views and components for controllers. Which of theese would be a
> better idea to share my logics. Or is there a third way to do this?
> Looking forward for any help from you
> Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


What to use (Component? Helper?) for methods used in both controller and view

2009-12-01 Thread drbuzasi
Hi!
I have some methods for several tasks that i need not only in
controllers or in views but in both of them. There are helpers for
views and components for controllers. Which of theese would be a
better idea to share my logics. Or is there a third way to do this?
Looking forward for any help from you
Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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