Add a sub action to a simple module
Hi there,
I've created a simple module:
http://docs.getfuelcms.com/modules/simpleIn the file "config/MY_fuel_modules.php", we've got:
$config['modules']['example'] = array(
'preview_path' => 'example/{slug}',
'sanitize_images' => FALSE, // to prevent false positives with xss_clean image sanitation
'list_actions' => array('example/upload' => lang('btn_upload')),
);
This has added a new action button called "upload".
When we visit "/fuel/example/upload" you get a frontend 404 error page.
Is there a simple way to make our simple module "example_model.php" handle sub actions?
Thanks.
Comments
I have same problem with sample "project module".
I have to copy navigation.php and pages.php to my application controller? with change or not change.
please explain me more
thanks
for example I create example module with preview_path=> 'example/id/x'
But I got 404 page not found. I made a controller and its action in my application but didn't change response.
In where clause I wana get id from segment and put it on my function list_items.
thanks for your answer
extra:
like projects/{slug} in your 3th tutorial, I create function get_url() and
return site_url('projects/id/' . $this->id);
http://docs.getfuelcms.com/general/pages-variables#specifying_a_view
I had 2 changes:
1- Add line 482 fuel/controllers/module.php
$this->js_controller_params['item_id'] = $this->uri->segment(4);
2- Edit line 16 fuel/assets/js/fuel/controller/BaseFuelController.js
this.tableAjaxURL = this.modulePath + '/items/'+initObj.item_id;
this is very simple way to get segment for all module.
I had some other changes for edit and create to work probably.
you can prepare this for next version of Fuel.
Thanks