开发者

PyroCMS: how to share resources between modules?

开发者 https://www.devze.com 2023-03-14 16:05 出处:网络
I\'m new to PyroCMS and struggling to get help on 开发者_如何学Pythonthe forums (slow responses, minimal activity, etc.). So, I\'m hoping someone here on SO can help.

I'm new to PyroCMS and struggling to get help on 开发者_如何学Pythonthe forums (slow responses, minimal activity, etc.). So, I'm hoping someone here on SO can help.

How do I share resources (e.g. models, controllers, views, etc.) between modules? It seems that every module is self contained and cannot access other modules' resources. This is going to cause a problem for us.

I do not like the idea of putting these common resources in the main PyroCMS installation. This seems architecturally wrong to me.


PyroCMS uses HMVC, so accessing resources from other modules is easy.

Let's say you want to load the model navigation_m:

This will work from within the navigation module (where it resides):

$this->load->model('navigation_m');

This will work from anywhere:

$this->load->model('navigation/navigation_m');

That's it! No need to include the model/ path, the loader takes care of it for you. Same applies to language files, libraries, and other resources.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号