Own folder structure

FvGFvG
edited August 2011 in Installation
Hey,
I'm working on a new site based on CI, it's not finished yet but it won't take long to do so.
Doing this with some friends I woud like to "change" our current version to Fuel, so we don't have to create a new function for every page; that's really annoying. I've got a very simple question: At the moment we're using the folder structure of CodeIgniter, was it possible to have something like this using Fuel, too?

- index.php
- assets/
- application/
- system/
- - codigniter/
- - modules/
...

Hope you get what I want to ask :)
Thanks

Comments

  • edited 1:50AM
    You would need to change the $system_path and $application_folder paths in the index.php file and possibly the MODULES_FOLDER constant in the fuel/modules/config/fuel_contstants.php file.
  • FvGFvG
    edited 1:50AM
    I made some changes right now:
    fuel_constants.php
    define('FUEL_VERSION', '0.9.3'); define('MODULES_FOLDER', 'fuel/modules'); define('FUEL_FOLDER', 'fuel'); define('MODULES_PATH', MODULES_FOLDER.'/'); define('FUEL_PATH', MODULES_PATH.FUEL_FOLDER.'/'); define('WEB_ROOT', str_replace('\\', '/', realpath(dirname(SELF)).DIRECTORY_SEPARATOR)); // replace \ with / for windows
    index.php
    $application_folder = 'application';
    But now I get this error:
    Fatal error: Call to undefined function base_url() in C:\xampp\htdocs\fuel\application\views\_blocks\header.php on line 10
    Any idea on how to fix this?
  • edited 1:50AM
    The base_url function is in the url_helper which is autoloader. However, in this case we are not getting that far. It may be that you are getting a 404 error message (see the application/errors/error_404.php file) which includes the header file.

    To debug, I would open up the fuel/codeigniter/core/CodeIgniter.php file and see where it may be throwing the 404 (there are 3 calls to the show_404()) function in that file to check).
  • FvGFvG
    edited 1:50AM
    Hmm, this is not a 404 error, it's a PHP error. I'm just wondering why I get this error, if it failed to include anything I'd get another one?!
  • FvGFvG
    edited 1:50AM
    I don't think it's a problem with fuel_constants.php - I just used the old index.php, moved the application folder back and it works fine!
  • FvGFvG
    edited 1:50AM
    I made some tests, it seems to be a problem right here:

    // CodeIgniter.php - line 157 $RTR =& load_class('Router', 'core'); echo 'test'; // works $RTR->_set_routing(); echo 'test2'; // doesn't work

    // Router.php - line 332 // If we got this far it means we didn't encounter a // matching route so we'll set the site default route echo 'test'; // works $this->_set_request($this->uri->segments); echo 'test'; // doesn't

    // Router.php - line 175 function _set_request($segments = array()) { echo 'test'; // doesn't work! $segments = $this->_validate_request($segments);

    This doesn't make any sence, does it?
  • edited 1:50AM
    Router is being overwritten by fuel/application/third_party/fuel/Router.php which itself extends fuel/application/third_party/MX/Router.php and that is probably why you aren't seeing your echo.
  • FvGFvG
    edited 1:50AM
    Okay, it really seems to be an 404 error. It's caused by _validate_request() in fuel/Router.php on line 144. In my 404 file I include a header.php from _blocks (which is correctly included), then it doesn't find the base_path() function. Acutally it should just open up my home.php view?!
  • FvGFvG
    edited 1:50AM
    Maybe there are just some problems including the helpers, if I open a page with a controller I get "Unable to load the requested file: helpers/fuel/fuel_helper.php".
    And base_url() is from a helper, too?! Sorry for posting that much, I just want to continue programming - It's driving me nuts :P
  • edited 1:50AM
    What happens if you change the values at the top of the application/third_party/MX/Modules.php to something like the following to match your path
    Modules::$locations = array( APPPATH.'../system/modules/' => '../../system/modules/', );
  • FvGFvG
    edited 1:50AM
    That's it :) Thank you so much!
Sign In or Register to comment.