Custom Controller for Simple Module
Hi,
I'm new to this FUELCMS, first impression its good! so far liking it.
However i have some concerns regarding the simple module. How to make custom controller for it.
I tried searching other discussion about this, but still i don't know where to start.
Some discussion still not clear to me.
Unfortunately there's no proper documentation about how to create custom controller in simple modules. (if it is possible)
I have created a simple module and i want to upload a csv file with proper data and save it into the database with the help of a controller.
Hope you can help me with step by step how to make it. Thank you in advance.
Comments
$route[FUEL_ROUTE.'my_module'] = FUEL_FOLDER.'/my_module'; $route[FUEL_ROUTE.'my_module/(.*)'] = FUEL_FOLDER.'/my_module/$1';
Alternatively, you can create an advanced module which allows you to house your model, views, controllers, helpers, language files, libraries, etc, in their own folder.
http://www.getfuelcms.com/user_guide/modules/advanced
If you are just getting started, I'd recommend taking a look at the 1.0 beta:
https://github.com/daylightstudio/FUEL-CMS/tree/1.0
Thanks!
Its just a simple module, so i think no need to create advance module for it.
I have added a upload button to my module.
$config['modules']['regions'] = array( 'preview_path' => 'Home/Contact/Store-Locator', 'list_actions' => array('regions/upload' => lang('btn_upload')), )
Do i need to create a regions controller in (fuel/modules/fuel/controllers)? and recreate views again? something like
require_once(FUEL_PATH.'/libraries/Fuel_base_controller.php'); class regions extends Fuel_base_controller { function __construct() { parent::__construct(); } function index() { $vars = array(); $this->_render('regions', $vars); } function upload() { } }
Thanks.
http://www.getfuelcms.com/forums/discussion/comment/2138/#Comment_2138
However, you can put the controller wherever you need and perhaps an application/controllers/admin/regions.php would be better to keep it out of the fuel folder. You can then create a route for that controller.