How to display the different
Rate Topic:
1 Votes

E.g. I'm in /user/index, and in this view "index", I want to invoke a function which is defined in "post" controller, what can I do? Or how can I invoke a controller (not the CURRENT controller) in a view

(PS: I'm sorry I submitted this post for a mistake with the uncompleted title, but I did not find where to change it.)

Is a bit strange that in a controller you need a function of another one controller.

Maybe this function should be in a model: if you are using the same model il both controllers you can put the function in the model (expecially if the function works with the data of the model itself).

If is not depending from the model, is better to create a Component for this function.

In my site, there are two links "A" and "B", they are referred to two controllers (/index.php/a and /index.php/. But both of them are the tabs of a tabview UI, when click the link (either link), it will take visitor to a view (e.g. mainpanle_tpl.php), in this view page, I use following codes to invoke the CTabView UI:

My purpose is to use different data in both tabs, but if use the codes above, the "$dataProvider" will be incorrect. When the tabview is shown up, it does not use the data in model B, instead, it uses the mode A's data in /b/index.

To resolve the problem, I want to re-build both of the Model A and Model B's data in the view page. And the re-build functions are defined in Controller A and Controller B. So I want to use Controller A's function in B's View and use Controller B's function in A's View.

But in this UI, how can I set the active tab or the UI tab? And how to make all the links and the form submittion to point to current tab? Maybe I should say how to make them work as AJAX in the current tab?

I used "CJuiTabs" instead of "CTabView", and you can check the extra parameters in Jquery UI section. Actually "CJuiTabs" extended Jquery Tabs UI by Yii, so you can also use the Jquery options in Yii CJuiTabs.