×
Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Multiple models in one view for J3.3
Ryk
Yeni Üye
Posts: 2
10 yıl 1 ay önce #404
Yazan: Ryk
Multiple models in one view for J3.3, Ryk tarafından oluşturuldu
First time I have used the creator - and congrats on a great product!
Hi - there is a similar thread already started, but my requirement is a little different so I thought I would keep it separate.
I am trying to get a blank view to show table data from 4 other views(tables) from the same component (generated here).
I have seen samples of how one can add multiple model calls in a view, but I have been unsuccessful in doing so.
I have gone down the path of modifying the controller:
then calling it in the view:but I am not getting any results.
I am loosing grey hair at a rate of knots over this, and it should not be that hard....Any assistance would really really be appreciated.
rgs
Ryk
Hi - there is a similar thread already started, but my requirement is a little different so I thought I would keep it separate.
I am trying to get a blank view to show table data from 4 other views(tables) from the same component (generated here).
I have seen samples of how one can add multiple model calls in a view, but I have been unsuccessful in doing so.
I have gone down the path of modifying the controller:
public function &getModel($name = 'MYcurrentmodel', $prefix = 'ccccc_datamanagementModel')
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
$model->setModel($this->getModel('MYmodel1'));
$model->setModel($this->getModel('MYmodel2'));
$model->setModel($this->getModel('MYmodel3'));
$model->setModel($this->getModel('MYmodel4'));
return $model;
}
then calling it in the view:
$this->item = $this->get('Items','MYmodel1');
I am loosing grey hair at a rate of knots over this, and it should not be that hard....Any assistance would really really be appreciated.
rgs
Ryk
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Ryk
Yeni Üye
Posts: 2
10 yıl 1 ay önce #407
Yazan: Ryk
Ryk tarafından Multiple models in one view for J3.3 konusunda yanıtlandı
Its ok - I managed to fudge it another way using modules.
Not the most elegant of solutions, but at least it gets the data in the without too much custom recoding.
Then I just called multiple modules into the page and direct calls to each cell from the array. (basically trying to get many tables to supply data to elements on one page).
cheers
Ryk
Not the most elegant of solutions, but at least it gets the data in the without too much custom recoding.
Then I just called multiple modules into the page and direct calls to each cell from the array. (basically trying to get many tables to supply data to elements on one page).
cheers
Ryk
Şu kullanıcı(lar) Teşekkür etti: Andres Maeso
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Jelani Aitch
Yeni Üye
Posts: 1
10 yıl 1 ay önce #442
Yazan: Jelani Aitch
Jelani Aitch tarafından Multiple models in one view for J3.3 konusunda yanıtlandı
Greetings.
Ryk, do you mind sharing your method for achieving multiple views(tables) on one page? I'm new to component creator and PHP. I assumed it would require adding various modules, but wasn't quite sure. Glad to see someone figure it out.
I'm creating a component that will have a user profile page. The user's profile page will require data from different tables, and only the rows specific to that user.
Thanks in advance for any insight you can provide.
Ryk, do you mind sharing your method for achieving multiple views(tables) on one page? I'm new to component creator and PHP. I assumed it would require adding various modules, but wasn't quite sure. Glad to see someone figure it out.
I'm creating a component that will have a user profile page. The user's profile page will require data from different tables, and only the rows specific to that user.
Thanks in advance for any insight you can provide.
Şu kullanıcı(lar) Teşekkür etti: John Benac
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
John Benac
Yeni Üye
Posts: 5
8 yıl 6 ay önce - 8 yıl 6 ay önce #1319
Yazan: John Benac
John Benac tarafından Multiple models in one view for J3.3 konusunda yanıtlandı
I also want multiple models on the same page. I'm building a "dashboard" with info from multiple database tables. I know I could try modules, but I want to do it right! Can anyone provide an example of using multiple models in one view with component creator? The documentation all over the internet for doing multiple models in Joomla goes something like this:
"
If the view requires data from more than one model, then the above code can be extended easily. For example, if view My3 requires data from models My1 as well as My3 then the controller task-method would look something like this:
$view = $this->getView( 'My3', 'html' );
$view->setModel( $this->getModel( 'My3' ), true );
$view->setModel( $this->getModel( 'My1' ) );
$view->display();
"
This code above is from here: docs.joomla.org/Using_multiple_models_in_an_MVC_component
However I have tried editing both the main component and the view specific component to tweak the models provided to no success. I know that component creator is supposed to follow joomla standard conventions, but I have spent hours trying to drop in this multi-model code from the joomla docs into my component creator code and it is not working. Help!
"
If the view requires data from more than one model, then the above code can be extended easily. For example, if view My3 requires data from models My1 as well as My3 then the controller task-method would look something like this:
$view = $this->getView( 'My3', 'html' );
$view->setModel( $this->getModel( 'My3' ), true );
$view->setModel( $this->getModel( 'My1' ) );
$view->display();
"
This code above is from here: docs.joomla.org/Using_multiple_models_in_an_MVC_component
However I have tried editing both the main component and the view specific component to tweak the models provided to no success. I know that component creator is supposed to follow joomla standard conventions, but I have spent hours trying to drop in this multi-model code from the joomla docs into my component creator code and it is not working. Help!
Son Düzenleme: 8 yıl 6 ay önce Düzenleyen:John Benac Neden: I have better thought out my issue
Şu kullanıcı(lar) Teşekkür etti: Andres Maeso, Walt Sorensen
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
John Benac
Yeni Üye
Posts: 5
8 yıl 6 ay önce #1321
Yazan: John Benac
John Benac tarafından Multiple models in one view for J3.3 konusunda yanıtlandı
I discovered and wrote of my solution here:
stackoverflow.com/questions/37223472/how...il/37224218#37224218
stackoverflow.com/questions/37223472/how...il/37224218#37224218
Şu kullanıcı(lar) Teşekkür etti: Walt Sorensen
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Stargazer
Yeni Üye
Posts: 3
8 yıl 5 ay önce #1344
Yazan: Stargazer
Stargazer tarafından Multiple models in one view for J3.3 konusunda yanıtlandı
John,
I have been struggling with this for days. Your response in the closest I have gotten to solving a problem I am having with my own component. I want to do the same thing, except I want to use a site model in an admin view? Do you know if that's possible?
I referenced your answer in my question on stack overflow here:
stackoverflow.com/questions/37548273/joo...odel-from-admin-view
So close . . . yet so far!
I have been struggling with this for days. Your response in the closest I have gotten to solving a problem I am having with my own component. I want to do the same thing, except I want to use a site model in an admin view? Do you know if that's possible?
I referenced your answer in my question on stack overflow here:
stackoverflow.com/questions/37548273/joo...odel-from-admin-view
So close . . . yet so far!
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Sayfa oluşturma süresi: 0.057 saniye