Kichu
Kichu

Reputation: 3267

Making common function in cakephp

I am new in cakephp, i want to know how to create a common function.

That means i have some code which will be repeated in multiple controllers at multiple time. So i want to make this codes into a function and us in different controllers.

How can i do this?

Upvotes: 2

Views: 1269

Answers (1)

Miheretab Alemu
Miheretab Alemu

Reputation: 976

Put the function in AppController.php because every controller extends this class. So you can access that function using $this->yourFunction();

Upvotes: 2

Related Questions