Welcome Guest, Not a member yet? Register   Sign In
set404Override and debug toolbar

(This post was last modified: 11-16-2021, 02:07 PM by mavelo.)

Anyone else able to get the debug toolbar to show on 404 overrides?


Debug toolbar shows on every page in 'development' environment EXCEPT the App\Foo::bar override

Note: Toolbar is displayed when accessing the same route via the /foo/bar in the browser.

CI_ENVIRONMENT and CI_DEBUG at Foo::bar echo 'development' and 'true' as expected.

Even tried passing debug to view('foo_bar', $data, ['debug' => true]) with no change.

Running out of ideas, sans modifying core files, which shouldn't be necessary.

CI Version: 4.1.3


Worth noting that HTML debug comments like <!-- DEBUG-VIEW START 5 APPPATH/Views/bar.php --> appear in source, but the toolbar script and style are not injected at <head>

(This post was last modified: 11-22-2021, 09:22 PM by kenjis.)

404 override does not show debug toolbar.
What do you need on 404 page?

(This post was last modified: 11-23-2021, 12:50 PM by mavelo.)

The site uses set404Override to route unmatched URI's to a controller/method thereby facilitating domain.com/username lookups.
  • If the username is not found, we display the 404 view
  • otherwise we show the matching user's profile.
If we route "/(:any)" to the same controller method, the debug toolbar is displayed, but it breaks automatic routing.

set404Override is a better solution for our needs, if not for the inability to show the debug toolbar in the "development" environment.

note: we attempted redirecting when a matching profile was found, but that doesn't seem to function normally when attempted within the override's method.

(This post was last modified: 12-02-2021, 09:12 AM by mavelo.)

We ended up using
header("Location: "/profile/{$username}", true 302); exit;
upon username match.

Would be nice if we could use
return redirect()->to("/profile/{$username}")
as in other areas, but that is not available in the 404 override controller/method.

Note: Added to config/routes.php to support the above code
$routes->get('profile/(:segment)', 'Profile::view/$1');

Theme © iAndrew 2016 - Forum software by © MyBB