Yii website homepage question: a website homepage is composed of many modules. each module corresponds to a controller in the background. how can this homepage be displayed?
For example, the home page of a travel website displays destination recommendations and route recommendations. The results of recommendation queries on the homepage are also acceptable.
Displayed on the destination homepage and line homepage. So how can this reusable query be processed?
Previously, I considered calling methods in various controllers through runcontroller in the homepage module, which is a little problematic and not very good. I think other people's source code is quite simple. No controller calls everywhere
Reply to discussion (solution)
With the yii pendant, each page calls the same pendant.
With the yii pendant, each page calls the same pendant.
Thank you. I understand what you said.
However, there is another problem: there is a set that needs to be displayed in the foreach display on the page corresponding to controller C1, but the data in this set needs to be collected through the query of controller C2 and C3, how can this problem be solved?
Can I check C2 and C3 data directly on the C1 controller?
Or you can write a public method in Components!
Create a comment class in components and write public methods. other controllers can call this class.
Create a comment class in components and write public methods. other controllers can call this class.
Thank you!
Can I check C2 and C3 data directly on the C1 controller?
Or you can write a public method in Components!
Thank you.