It looks like you're new here. If you want to get involved, click one of these buttons!
$ php index.php fuel/installer/update
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant EXT - assumed 'EXT'
Filename: C:\xampp\htdocs\Nordegg\fuel\modules\fuel\core\Router.php
Line Number: 201
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant EXT - assumed 'EXT'
Filename: C:\xampp\htdocs\Nordegg\fuel\application\third_party\MX\Modules.php
Line Number: 168
Fatal error: Call to undefined method MY_Router::_set_404override_controller() i
n C:\xampp\htdocs\Nordegg\fuel\modules\fuel\core\Router.php on line 161
A PHP Error was encountered
Severity: Error
Message: Call to undefined method MY_Router::_set_404override_controller()
Filename: C:\xampp\htdocs\Nordegg\fuel\modules\fuel\core\Router.php
Line Number: 161
Comments
Thanks!
I just updated to 1.4. I got the backend working, but in the frontend all urls are redirected to the codeigniter default 404 page.
In CodeIgniter.php $e404 always results in true. Any idea which point ist the best to start debugging?
The following lines always result in $e404 being true, so that the default codeigniter 404 page is shown.
I don't know why the Fuel CMS route handling does not work any more. Do you have an idea, how I can check if the Fuel CMS module is called? Is there a hook I can debug for example?
First issue was that in my installation not all custom files had the prefix MY in uppercase. Some where in lowercase my ... so my custom MY_page_router wasn't found...
Now I have the 404 page of my fuel cms installation. I will do further debugging :-)
UPDATE: strange behaviour... the homepage is handled via the 404_override ... _remap method of MY_page_router (which extends Page_router) is entered with uri_path(TRUE) = MY_page_router
Why is the controller name returned by uri_path?
uri_path is called 3 times on loading the base url. First and second time returns empty array, last time returns the controller name...
uri_path(TRUE) results in controller name, uri_path(FALSE) results in empty string.
MY_page_router content is as discussed in http://forum.getfuelcms.com/discussion/2611/redirecting-to-404#Item_16
include_once($_ENV["DOC_ROOT"] . "/fuel/modules/fuel/controllers/Page_router.php"); class MY_page_router extends Page_router { public function _remap($method = NULL) { if (!in_array(uri_path(TRUE), $this->fuel->pages->cms()) && uri_path(TRUE) != "offline") { $uri_path = uri_path(TRUE); if (substr($uri_path, -1) == "/") { $uri_path = rtrim($uri_path, "/"); } elseif (is_numeric(substr($uri_path, strrpos($uri_path, "/") + 1))) { $uri_path = rtrim($uri_path, substr($uri_path, strrpos($uri_path, "/"))); } if (!in_array($uri_path, $this->fuel->pages->cms())) { $this->location = "404_error"; } else { $this->location = uri_path(TRUE); } } else { $this->location = uri_path(TRUE); } // if the rerouted file can't be found, look for the non-routed file' if (!file_exists(APPPATH . 'views/' . $this->location . EXT)) { $non_routed_uri = uri_path(FALSE); if (file_exists(APPPATH . 'views/' . $non_routed_uri . EXT)) { $this->location = $non_routed_uri; } unset($non_routed_uri); } if (empty($this->location)) $this->location = $this->fuel->config('default_home_view'); $config = array(); $config['location'] = $this->location; if ($this->fuel->pages->mode() == 'views') { $config['render_mode'] = 'views'; $page = $this->fuel->pages->create($config); $this->_remap_variables($page); } // using FUEL admin else { if ($this->fuel->pages->mode() != 'cms') { $config['render_mode'] = 'auto'; if ($this->fuel->config('uri_view_overwrites')) { // loop through the pages array looking for wild-cards foreach ($this->fuel->config('uri_view_overwrites') as $val) { // convert wild-cards to RegEx $key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $val)); // does the RegEx match? if (preg_match('#^' . $val . '$#', $config['location'])) { $config['render_mode'] = 'views'; } } } $page = $this->fuel->pages->create($config); if ((!$page->has_cms_data() AND $config['render_mode'] == 'auto') OR $config['render_mode'] == 'views') { $this->_remap_variables($page); return; } } else { $config['render_mode'] = 'cms'; $page = $this->fuel->pages->create($config); } $this->_remap_cms($page); } } }
The URL http://dev.feuerwehr-bs.de/technik/fahrzeuge/16 is working. Here in CodeIgniter.php line 403 $class= My_page_router and method = index
The URL http://dev.feuerwehr-bs.de is not working. $class = "" and $method = "index"
The URL http://dev.feuerwehr-bs.de/aktuelles/einsaetze/2922 is also not working. $class = "Einsaetze" $method = "2922".
First and third URL should go through exact the same Routing...
1. "normal" cms page created in the backend -> works fine
2. "normal" cms page with additional controller (for form processing) -> page loading works fine but form submit fails in 404
3. "module" cms page created in the backend but gets the content from simple modules -> some work, others not
4. homepage cms page created in the backend but gets its content from a controller -> does not work
I have created 2 layout libraries Main_layout and Module_layout. Main_layout handles type 1 + 2. Module_layout handles 3 + 4.
The most strange thing at the moment for me is that http://dev.feuerwehr-bs.de/technik/fahrzeuge/16 is working and http://dev.feuerwehr-bs.de/aktuelles/einsaetze/2922 is not working. Both pages are handled via Module_layout. But the second one ends up in 404 before being routed to the layout library.
What is the replacement for the Fuel_hook pre_controller? Where is that handled now?
As I continue debugging I will just note here all things I find as difference between the two mentioned pages.
1. in fuel/core/Router.php: I added a var_dump and die for $segments in line 183 just before $this->_set_rsegments call. The working page does not pass this line of code, the not working page stops here with:
array(2) { [0]=> string(9) "einsaetze" [1]=> string(4) "2922" }
UPDATE: ok... for this page I got a little bit further... I have a page aktuelles/presse which has a form, which is handled by a controller method... because of this I have a subfolder aktuelles in my application/controller folder. Now fuel/core/Router.php line 282 finds this subdirectory and removes the array key with the subfolder name from the $segments array.
I got it working with following code:
/* application sub-directory controller exists? */ if ($directory) { if (is_file(APPPATH . 'controllers/' . $module . '/' . ucfirst($directory) . $ext)) { $this->directory = $module . '/'; return array_slice($segments, 1); } /* application sub-sub-directory controller exists? */ if ($controller) { if (is_file(APPPATH . 'controllers/' . $module . '/' . $directory . '/' . ucfirst($controller) . $ext)) { $this->directory = $module . '/' . $directory . '/'; return array_slice($segments, 2); } } } else { /* application controllers sub-directory exists? */ if (is_dir(APPPATH . 'controllers/' . $module . '/')) { $this->directory = $module . '/'; return array_slice($segments, 1); } } /* application controller exists? */ if (is_file(APPPATH . 'controllers/' . ucfirst($module) . $ext)) { return $segments; }
I added an else branch to check for sub-directory only if $directory is empty. Now type 3 works for all pages. I go on checking for type 2 and 4
UPDATE 2: I think the issue was that my controllers where also named lowercase and not with first letter in UC... I go on checking...
Do you think this causes problems in other scenarios?
I have another page feuerwehr-bs.de/aktuelles which is defined as redirect to feuerwehr-bs.de/aktuelles/news in the cms... because I have the folder aktuelles in controllers this results in 404...
keep on checking ;-)
On uncommenting the whole block
//else { // /* application controllers sub-directory exists? */ // if (is_dir(APPPATH . 'controllers/' . $module . '/')) { // $this->directory = $module . '/'; // return array_slice($segments, 1); // } // }
it worked for me...
What should happen, if the controller directory exists, but no further parameters are given?
I've just updated to 1.4 and got assets output problem,
when setting assets output to 'combine' or TRUE :
<?=css($css, null, array('output' => 'combine')); ?>
I get the broken link:
/assets/807e9bc71a0de8c3bae403db24394c75_.css
it should be like this:
/assets/cache/807e9bc71a0de8c3bae403db24394c75_.css
in app/config/asset.php got this line:
$config['assets_cache_folder'] = 'cache/';
but cache folder steel don't appear in link path
$config['assets_cache_folder'] = 'cache';
No matter what value the variable has, the path remains unchanged.
I checked the behavior on a fresh version of 1.4 and there was no such problem.
It turned out that problem was in config file app/config/asset.php,
my version had this var:
$config['assets_folders'] = array( 'images' => 'images/', 'css' => 'css/', 'js' => 'js/', 'pdf' => 'pdf/', 'swf' => 'swf/', 'media' => 'media/', 'captchas' => 'captchas/', 'docs' => 'docs/', );
and it should be:
$config['assets_folders'] = array( 'images' => 'images/', 'css' => 'css/', 'js' => 'js/', 'pdf' => 'pdf/', 'swf' => 'swf/', 'media' => 'media/', 'captchas' => 'captchas/', 'docs' => 'docs/', 'cache' => 'cache/' );
My bad, sorry.
Thanks for help!
I just got into the CI->Upload.php file and in the function is_allowed_filetype I changed $ignore_mime to TRUE and it was able to upload, so for some reason, it's not passing something into that method properly after my upgrade from 1.3 to 1.4.
Any ideas? I can leave the $ignore_mime as TRUE for my purposes, but I would be curious of an answer
Thanks.
sorry I had no time to answer for 2 weeks...
Coming back to my confusing posts :-)
This is your Router.php
/* application sub-directory controller exists? */ if($directory) { if(is_file(APPPATH.'controllers/'.$module.'/'.ucfirst($directory).$ext)) { $this->directory = $module.'/'; return array_slice($segments, 1); } /* application sub-sub-directory controller exists? */ if($controller) { if(is_file(APPPATH.'controllers/'.$module.'/'.$directory.'/'.ucfirst($controller).$ext)) { $this->directory = $module.'/'.$directory.'/'; return array_slice($segments, 2); } } } /* application controllers sub-directory exists? */ if (is_dir(APPPATH.'controllers/'.$module.'/')) { $this->directory = $module.'/'; return array_slice($segments, 1); } /* application controller exists? */ if (is_file(APPPATH.'controllers/'.ucfirst($module).$ext)) { return $segments; }
My adjusted file:
/* application sub-directory controller exists? */ if ($directory) { if (is_file(APPPATH . 'controllers/' . $module . '/' . ucfirst($directory) . $ext)) { $this->directory = $module . '/'; return array_slice($segments, 1); } /* application sub-sub-directory controller exists? */ if ($controller) { if (is_file(APPPATH . 'controllers/' . $module . '/' . $directory . '/' . ucfirst($controller) . $ext)) { $this->directory = $module . '/' . $directory . '/'; return array_slice($segments, 2); } } } /* application controller exists? */ if (is_file(APPPATH . 'controllers/' . ucfirst($module) . $ext)) { return $segments; }
My application/controllers directory has following content:
aktuelles/Presse.php
mission_admin/Mission_admin.php
terminimport/Terminimport.php
Homepage.php
Impressum.php
Kontakt.php
Maintenance.php
MY_page_router.php
Ticketshop.php
In my CMS I have a page defined as redirect with the route "aktuelles".
Now with your code the check "application controllers sub-directory exists?" finds the subdirectory and redirects to 404 page. By removing the check I achieved, that my scenario works.
KR
Habib
$config['editable_asset_filetypes'] = array( 'images' => 'jpg|jpeg|jpe|gif|png|zip|svg', 'pdf' => 'pdf|zip', 'media' => 'mov|mp3|aiff|mpeg|zip', 'assets' => 'jpg|jpeg|jpe|png|gif|mov|mpeg|mp3|wav|aiff|pdf|css|zip|svg' );
There are 2 places in the code where that error can be thrown. One is in the CI_Upload class itself. The other is in the Fuel_assets::upload() method around line 166. Is the error being thrown there?