module widget outside of the module

Is it possible to use a module widget outside of the module? If so, how do I go about doing that?

For example, I recently converted the blog tutorial to a module (thx Pradhan!), and I created a Recent Posts widget (very similar to the Recent Comments widget) that I would like to use not only within the module but also on all of the pages of my site outside of the module. Is there an easy way to do this?

Thanks!


$this->widget('myModule.components.MyWidget');

Thanks for your reply.

I’m getting the following error message:


include(Post.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory

Do I have to do anything else to access the modules models?

try to import the post module inside the widget

something like


Yii::import(''MyModule.models.Post);

That did it! Thanks!

This is what I was looking for, thanks!!

Gracias no sabia como hacerlo :)

Thank you very much for your great help. This help me too. :)