Re: function problem in controller

2010-07-14 Thread euromark
well i guess you meant it the other way around^^

add() and _text()


On 14 Jul., 11:04, euromark  wrote:
> its very unlikely that all 1000 lines need to be in the controller
> most of them can be outsourced to libs, components or even model
> functions
>
> only the remaining lines (maybe the half) should then be divided - and
> only if it makes sense
> you should add _ in front of the method, though. this way its not a
> normal action but a controller specific submethod
>
> function text() {
>  //doSomething
>  $this->_add();
>  $this->_addMore($params); // its possible to pass params
>  //doSomethingElse
>
> }
>
> function _add() {
>  //doSomethingDifferent
>
> }
>
> function _addMore($params) {
>  //doSomethingTotallyDifferent
>
> }
>
> this does usually make sense if several functions need the same
> functionality (like passing some navigation to the view) and you dont
> want to repeat yourself.
> in your case it can make sense, too - that is if it really helps to
> make the code more readable and testable.
>
> On 14 Jul., 08:15, Master Ram  wrote:
>
>
>
> > Hi. to all
>
> > in my controller i am using one function.
>
> > function text() {
>
> > ;;; 1000 lines of code
> > ;;;
>
> > }
>
> > function add() {
>
> > //Here i want same code. is having in text function. it is possible to
> > call text() here.
>
> > // i want to reduce the code.
>
> > }

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: function problem in controller

2010-07-14 Thread euromark
its very unlikely that all 1000 lines need to be in the controller
most of them can be outsourced to libs, components or even model
functions

only the remaining lines (maybe the half) should then be divided - and
only if it makes sense
you should add _ in front of the method, though. this way its not a
normal action but a controller specific submethod

function text() {
 //doSomething
 $this->_add();
 $this->_addMore($params); // its possible to pass params
 //doSomethingElse
}

function _add() {
 //doSomethingDifferent
}

function _addMore($params) {
 //doSomethingTotallyDifferent
}

this does usually make sense if several functions need the same
functionality (like passing some navigation to the view) and you dont
want to repeat yourself.
in your case it can make sense, too - that is if it really helps to
make the code more readable and testable.


On 14 Jul., 08:15, Master Ram  wrote:
> Hi. to all
>
> in my controller i am using one function.
>
> function text() {
>
> ;;; 1000 lines of code
> ;;;
>
> }
>
> function add() {
>
> //Here i want same code. is having in text function. it is possible to
> call text() here.
>
> // i want to reduce the code.
>
>
>
> }

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: function problem in controller

2010-07-14 Thread Jeremy Burns | Class Outfit
$this->text();

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 14 Jul 2010, at 07:15, Master Ram wrote:

> Hi. to all
> 
> in my controller i am using one function.
> 
> function text() {
> 
> ;;; 1000 lines of code
> ;;;
> }
> 
> function add() {
> 
> //Here i want same code. is having in text function. it is possible to
> call text() here.
> 
> // i want to reduce the code.
> 
> }
> 
> 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

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


function problem in controller

2010-07-13 Thread Master Ram
Hi. to all

in my controller i am using one function.

function text() {

;;; 1000 lines of code
;;;
}

function add() {

//Here i want same code. is having in text function. it is possible to
call text() here.

// i want to reduce the code.

}

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