You can make a Component
http://book.cakephp.org/view/64/Creating-Components

Best regards
On 20/04/2010, at 05:52, Narendra Padala wrote:

Hi all..!
I am new to cakephp i have problem, i have to use same code in
multiple functions, example

<?php
class UsersController extends AppController
{
   var $name = "Users";

   function index()
   {

     $x=5;
     $y=10;
     $z=$x+$y;

   }
   function demo()
   {

     $x=5;
     $y=10;
     $z=$x+$y;

   }
}
?>

My Problem is, how can i avoid this code redundancy , Is their any the
common code will write one file and i have to include file, or i have
to write the common code in one function and
i have to call in the controller functions. Please help me
out....thanks in advance

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 [email protected]
To unsubscribe from this group, send email to
[email protected] 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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to