Yii Framework Forum: module widget outside of the module - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

module widget outside of the module Rate Topic: -----

#1 User is offline   Farberama 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 17-November 10

Posted 27 January 2011 - 12:58 PM

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!
0

#2 User is offline   Gustavo 

  • Master Member
  • Yii
  • Group: Moderators
  • Posts: 916
  • Joined: 27-July 10
  • Location:Curitiba - Brasil

Posted 27 January 2011 - 01:26 PM

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

--
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application

Gustavo Salomé Silva
3

#3 User is offline   Farberama 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 17-November 10

Posted 27 January 2011 - 01:39 PM

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?
0

#4 User is offline   Gustavo 

  • Master Member
  • Yii
  • Group: Moderators
  • Posts: 916
  • Joined: 27-July 10
  • Location:Curitiba - Brasil

Posted 27 January 2011 - 02:02 PM

try to import the post module inside the widget
something like
Yii::import(''MyModule.models.Post);

--
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application

Gustavo Salomé Silva
0

#5 User is offline   Farberama 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 17-November 10

Posted 27 January 2011 - 02:26 PM

That did it! Thanks!
0

#6 User is offline   Webnet668 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 23-October 12

Posted 25 October 2012 - 01:56 PM

This is what I was looking for, thanks!!

View PostGustavo, on 27 January 2011 - 01:26 PM, said:

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


0

#7 User is offline   nofunciona 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 19-May 15
  • Location:Colombia

Posted 12 November 2015 - 01:22 PM

View PostGustavo, on 27 January 2011 - 01:26 PM, said:

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


Gracias no sabia como hacerlo :)
0

#8 User is offline   anurasn 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 24-April 14

Posted 01 August 2018 - 12:13 PM

View PostGustavo, on 27 January 2011 - 02:02 PM, said:

try to import the post module inside the widget
something like
Yii::import(''MyModule.models.Post);


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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users