trying to add module to dashboard (under tools)

edited February 2013 in Modules
I've studied every example and just don't see the difference ....

My module "cheat-sheet" gets into the menu, but there is something not right with the path -- it looks like MODULES_PATH is never being set:

The error:
A PHP Error was encountered Severity: Notice Message: Undefined offset: 1 Filename: hooks/Fuel_hooks.php Line Number: 48 A PHP Error was encountered Severity: Warning Message: require_once(/home2/fnpsorg/public_html/fuel/application/../modules/fuel//controllers/.php) [function.require-once]: failed to open stream: No such file or directory Filename: hooks/Fuel_hooks.php Line Number: 48

cheat_sheet_constants.php:
<?php define('CHEAT_SHEET_VERSION', '0.1'); define('CHEAT_SHEET_FOLDER', 'cheat_sheet'); define('CHEAT_SHEET_PATH', MODULES_PATH.CHEAT_SHEET_FOLDER.'/');

cheat_sheet_routes.php
<?php $route[FUEL_FOLDER.'tools/cheat_sheet'] = CHEAT_SHEET_FOLDER;

cheat_sheet.php (config --- this is working ---- it gets in the menu and the link looks correct)
<?php $config['nav']['tools']['tools/cheat_sheet'] = 'Cheat Sheet';

cheat_sheet.php (controller --- this is never loading)
<?php require_once(FUEL_PATH.'/libraries/Fuel_base_controller.php'); /** * * Cheat Sheet - a FuelCMS Module * The dashboard controller will add a examples within the dashboard * that show how to implement key features of fnps.org as a fuelcms application. */ class Dashboard extends Fuel_base_controller { function __construct() { parent::__construct(); $this->config->load('cheat_sheet'); } function index() { /* At least for now, $data is not set */ echo 'got here'; $data['dummy'] = 'nada'; $this->load->view('cheat_sheet.php', $data); } }

My_fuel (extract)
// specifies which modules are allowed to be used in the fuel admin $config['modules_allowed'] = array( 'user_guide', 'blog', 'backup', 'seo', 'validate', 'tester', 'cheat_sheet', 'cronjobs' );

I think I've copied every variant of how to do this that you have in the site -- seo, validate, chronjobs, etc. and the result is always the same. There has to be something very basic about why it isn't getting found -- the error is always the same no matter which of your modules I mimic. I've tried putting it in as a dashboard, and it will come in with the fuel dashboard, which isn't where I want it! Is there something special I'm supposed to be doing to get "MODULES_PATH" reconized?

What am I missing?

Thanks.

Comments

  • edited 11:31AM
    A couple things:
    1. Remove the ".php" from the load->view statement in the controller.
    2. Be sure to the module's name is added in the MY_fuel.php $config['fuel_dashboards'] array.
  • edited February 2013
    Neither help.

    If I have an identical controller called "dashboard.php" and add the module to the $config['dashboards'] array then it shows up as an item on the dashboard page....it is found, and it works. But this is not where it needs to be.

    If I have an identical (other than name) controller called "cheat_sheet.php" and I want it in the tools section of the admin menu, it is never found. I've tried many variants of setting up those constants and routes, all based on the items in that tools section that do work.

    As you can see from that error
    require_once(/home2/fnpsorg/public_html/fuel/application/../modules/fuel//controllers/.php)
    the name of the controller is missing, and there are two // where there should be more to the path.

    (the code I copied above did have an error --- due to my varied tries --- the controller that fails does start with
    class Cheat_sheet extends Fuel_base_controller {


    The error (when I go off from the tools section) is identical regardless of the$config['dashboards'] array... and the only difference between the two controllers is the name....call it dashboard and tell it to go in the dashboard page, it works....call it "Cheat_sheet" and want it off the tools section of the menu, it fails. The tools section URL comes through as www.fnps.org/fuel/tools/cheat_sheet when I mouse over it (looks correct, or at least the same as all the other tools section modules.


    Does this help?
  • edited 11:31AM
    Try FUEL_ROUTE for the constant in the route instead of FUEL_FOLDER (which doesn't have the trailing slash):
    $route[FUEL_ROUTE.'tools/cheat_sheet'] = CHEAT_SHEET_FOLDER;
  • edited 11:31AM
    That certainly changed the flavor of the error .... might there be a configuration problem?

    An Error Was Encountered The configuration file development/cheat_sheat.php and cheat_sheat.php do not exist.

    What is "development" ??
  • edited 11:31AM
    In your controller, try this to load the config:
    $this->config->module_load(CHEAT_SHEET_FOLDER, 'cheat_sheet');
    OR
    $this->config->load(CHEAT_SHEET_FOLDER.'/cheat_sheet');
Sign In or Register to comment.