It looks like you're new here. If you want to get involved, click one of these buttons!
Hi,
I'm really lost in how to render the content of an advanced module in my main layout ($vars['body'])
in:
/app/fuel/modules/partner/controllers/Partner.php
I got:
<?php
class Partner extends CI_Controller {
var $partner_config;
function __construct()
{
parent::__construct();
$this->partner_config = $this->fuel->partner->config();
}
function index()
{
ddd('index');
}
/**
* Submit a new Partner Entry
* @return void
*/
function submit()
{
$this->load->library(
'form_builder',
array(
'id'=>'addPartner',
'form_attrs' => array(
'method' => 'post',
'action' => '/partner/submit'
),
'submit_value' => 'Neuen Eintrag hinzufügen',
'textarea_rows' => '5',
'textarea_cols' => '28',
'render_format' => 'divs',
'label_layout' => 'top'
)
);
$fields = array(
'name' => array(
'label' => 'Full Name',
'required' => true
),
'comment' => array(
'type' => 'text',
'label' => 'Comment',
'required' => true
)
);
$this->form_builder->set_fields($fields);
$vars = [
'form' => $this->form_builder->render()
];
// render `/app/fuel/modules/partner/views/submit.php`
$vars['body'] = $this->load->module_view('partner', 'submit', $vars, true);
// how to render the form in my main layout in /fuel/application/views/layouts/main.php ?
}
}
I could do something like this the CI way: $output = $this->load->view('_layouts/main', $vars, TRUE);
but what is the fuel way including all the vars/fields that I expect from my layout?
and second:
I use the fuel form_builder how can I utilize all the fuel validation etc. that's used in the backend, after I _POST the form here in the controller? I think about retrieving all DB Fields like I would in Partner_model->form_fields();
Thank you!
Comments
Got it rendered this way.
I have no idea what this is doing behind the scenes :-(
Ho do you keep track of all the places where to configure or set up thing, and which method to use?
This helped a little bit: https://forum.getfuelcms.com/discussion/2977/using-the-application-views-layouts-main-php-in-advanced-modules/p1
Now getting the form set up