Reuse controllers and views

Hi, i have in my site a module named "sites" that use a forum board which has one controller ForumController.php and multiple views. The model use polymorphic association, now i need use this controller and views in another module "pages", is good practique create a parent forum Controller (eg. BaseForumController.php) and extend it in each module?.

BaseForumController.php and views (What is the best place for this files? components? )

and then, in each module

module/sites/controllers/ForumController.php (extend BaseForumController.php)

module/pages/controllers/ForumController.php (extend BaseForumControler.php)

Is this a correct way?

P.D. I use modules to organize a big application and modules are not a self-contained software units.

There is certainly nothing wrong with using a single base controller, perhaps placed in the components (or other shared) directory from which all of your other forum controllers extend.

Depending on your specific needs and what needs to be shared across these controllers, you may also want to look at Behaviors:

As a way to reuse code across controllers without specifically using OO inheritance.

Thanks for reply.

is it possible use CComponentBehaviour for made action behaviour?

class CForumBehaviour extends CBehavior{


	public function actionIndex(){




and then

class ForumController {

	public function init(){






this example doesnt works.