I am hoping that someone can kindly offer me a bit of advice for my first Yii project that I am building.
I have successfully create various areas of an administration area where each page has it’s own view, controller and model. It is basically things like users, enquiries and properties etc. so each page is served from a single database table through a model, controller and view.
On one of the sections however I need to create a page that features subpages using Bootstrap tabs and each tab will show content from a different table. For example;
The page is to be a CRM section and each tab will show the following:
Tab 1 - CRM People
Tab 2 - CRM Companies
Tab 3 - CRM Addresses
Tab 4 - CRM Groups
The 4 areas above all already have their own database table but this will be just 1 view.
I am wondering how I go about this? Does each area need to have it’s own model & controller? Do they need to be combined somehow or is there another way of doing this?
Many thanks in advance.
You could use renderPartial for every tabs you need to display (if you need to reuse code in other parts of your software)
i suggest you to use "Jquery Tabs UI"
Hi and thanks.
I have used renderPartial on some of the other sections so I am now quite familiar with it.
So does that mean I should go ahead and create all of the models and controllers for each of the database tables and bring them in the through renderPartial in the single view?
How does this effect the actions?
Hi again guys,
Sorry to open this post again but I am really struggling with this one now.
I have created a view file for the main CRM page, put the bootstrap tabs widget in and added new tabs to the array. I am then trying to use renderPartial to pull in the index view files of each model including CRM People, CRM Locations and CRM Companies. My view file looks like this:
array('label'=>'People', 'content'=>$this->renderPartial('//crmPeople/index', array('model'=>$model), $this)),
array('label'=>'Locations', 'content'=>$this->renderPartial('//crmLocations/index', array('model'=>$model), $this)),
array('label'=>'Companies', 'content'=>$this->renderPartial('//crmCompanies/index', array('model'=>$model), $this)),
This is however bringing up Undefined variable: model errors.
I have used renderPartial from the same model and controller without any problems but cannot get this to work.
I really appreciate any help anyone can offer.