PyroCMS: how to distribute resources between modules?

I am new to PyroCMS and struggling to get help on the forums (slow responses, minimal activity, etc.). So, I hope someone here on SO can help.

How to share resources (e.g. models, controllers, views, etc.) between modules? It seems that each module is autonomous and cannot access the resources of other modules. This will cause a problem for us.

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

+6
source share
1 answer

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

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

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

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

This will work anywhere:

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

What is it! No need to include the model/ path, the bootloader will take care of this for you. The same applies to language files, libraries, and other resources.

+11
source

Source: https://habr.com/ru/post/891172/


All Articles