YII website homepage question

Source: Internet
Author: User
Excuse me, a website home has a lot of modules, each module in the background corresponding to a controller, then this home page show how to deal with?
For example: A travel site, home page shows a destination recommendation and route recommendations. The first page of the recommended query results can also be
displayed on the home page of the destination and on the first page of the line. So how can this reusable query be handled?

Before considering is in the home module through the Runcontroller call each controller inside the method, a little problem, and feel not very good, I see other people's source code is pretty simple. There are no controllers everywhere to call


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, you said I understand.
However, there is a problem, there is a set to the controller C1 corresponding to the page in the foreach display, but this collection of data is to be through the controller C2 and C3 query together, how to deal with this?

Is it possible to find the data of C2 and C3 directly in the C1 controller?
Or you write a public method in the components!

Create comment classes in components, write public methods, and other controllers can be called.

Create comment classes in components, write public methods, and other controllers can be called.

I see, thank you.

Is it possible to find the data of C2 and C3 directly in the C1 controller?
Or you write a public method in the 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.