Yii website homepage

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.