Have you setup a route for that in your config/anunturi_routes.php file (I couldn't see in the image)? You'll want to do a route something like this: $route[FUEL_ROUTE.'anunturi/rent_categories'] = ANUNTURI_FOLDER.'/module';
$route[FUEL_ROUTE.'anunturi/anunturi/rent_categories/(.*)'] = ANUNTURI_FOLDER.'/module/$1';
I guess it should be like this: $route[FUEL_ROUTE.'anunturi/rent_categories'] = FUEL_FOLDER.'/module'; $route[FUEL_ROUTE.'anunturi/anunturi/rent_categories/(.*)'] = FUEL_FOLDER.'/module/$1';
Oops... yes, that is correct. It should be FUEL_FOLDER instead of ANUNTURI_FOLDER (assuming that that is where you are wanting to route things which is most likely).
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Module::$model_name
Filename: controllers/module.php
Line Number: 79
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /public_html/codeigniter_stuff/fuel/fuel/codeigniter/core/Exceptions.php:170)
Filename: core/Common.php
Line Number: 414
An Error Was Encountered
Unable to locate the file: .php
Would you mind emailing me those module files and any SQL. I'm not able to immediately see the issue? My email address is under my profile if you click on the my image.
Name the module key "anunturi_rent" instead of "rent" like so: <?php
$config['modules']['anunturi_rent'] = array(
'module_name' => 'Rent',
'module_uri' => 'anunturi/rent',
'model_name' => 'rent_model',
'model_location' => 'anunturi',
'table_headers' => array(
'id',
'name',
'slug',
'published',
),
'nav_selected' => 'anunturi/rent',
);
The reason is because FUEL looks at the URI path to determine which module configuration to pull in, and when you are using an advanced module, it needs to be prefixed like that. Not obvious I know.
yeeeeee It`s working. Thank you for that. Probably I`ll have some more questions, but for now...I can go on with understanding fuel and testing what I`ve learned.
Comments
$route[FUEL_ROUTE.'anunturi/rent_categories'] = ANUNTURI_FOLDER.'/module'; $route[FUEL_ROUTE.'anunturi/anunturi/rent_categories/(.*)'] = ANUNTURI_FOLDER.'/module/$1';
$route[FUEL_ROUTE.'anunturi/rent_categories'] = FUEL_FOLDER.'/module';
$route[FUEL_ROUTE.'anunturi/anunturi/rent_categories/(.*)'] = FUEL_FOLDER.'/module/$1';
A PHP Error was encountered Severity: Notice Message: Undefined property: Module::$model_name Filename: controllers/module.php Line Number: 79 A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at /public_html/codeigniter_stuff/fuel/fuel/codeigniter/core/Exceptions.php:170) Filename: core/Common.php Line Number: 414 An Error Was Encountered Unable to locate the file: .php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); require_once(FUEL_PATH.'models/base_module_model.php'); class Rent_model extends Base_module_model { public $record_class = 'Rent_category'; function __construct() { parent::__construct('sa_rent_categories', ANUNTURI_FOLDER); // table name } function list_items($limit = NULL, $offset = NULL, $col = 'name', $order = 'desc') { $this->db->select('id, name, slug, published'); $data = parent::list_items($limit, $offset, $col, $order); return $data; } function _common_query() { parent::_common_query(); // to do active and published $this->db->order_by('name desc'); } function form_fields($values = array()) { $fields = parent::form_fields(); $CI =& get_instance(); $fields['slug'] = array('label' => 'Slug'); return $fields; } } class Rent_category_model extends Base_module_record { function get_url() { if (!empty($this->slug)) return "inchirieri/".$this->slug; return site_url('inchirieri/'.$this->id); } } ?>
<?php require_once(FUEL_PATH.'/libraries/Fuel_base_controller.php'); class Rent extends Fuel_base_controller { public $nav_selected = 'anunturi/rent'; public $view_location = 'rent'; function __construct() { parent::__construct(); $this->load->module_model(ANUNTURI_FOLDER, 'rent_model'); } function index() { echo "test"; } } /* End of file rent.php */ /* Location: ./fuel/modules/anunturi/controllers/rent.php */
P.S. I removed the word 'categories' from all the names of my files from the printscreen
<?php $config['modules']['rent'] = array( 'module_name' => 'Rent', 'module_uri' => 'anunturi/rent', 'model_name' => 'rent_model', 'model_location' => 'anunturi', 'table_headers' => array( 'id', 'name', 'slug', 'published', ), 'nav_selected' => 'anunturi/rent', );
$route[FUEL_ROUTE.'anunturi/rent_categories/(.*)'] = FUEL_FOLDER.'/module/$1'
See if that helps.
<?php $config['modules']['anunturi_rent'] = array( 'module_name' => 'Rent', 'module_uri' => 'anunturi/rent', 'model_name' => 'rent_model', 'model_location' => 'anunturi', 'table_headers' => array( 'id', 'name', 'slug', 'published', ), 'nav_selected' => 'anunturi/rent', );
The reason is because FUEL looks at the URI path to determine which module configuration to pull in, and when you are using an advanced module, it needs to be prefixed like that. Not obvious I know.