Welcome Guest, Not a member yet? Register   Sign In
set404Override - setLocale not working?
#7

I found a different solution:
config\routes.php:
PHP Code:
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Home');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override(function()
{
    $header = array(
    'css' => 'nodata',
    'title' => 'Page not found | wdeda'
    );
    
    
echo view('templates/headerr'$header);
    echo view('content/error_404');
    echo view('templates/footerfb');
    }); 

There is a controller:
PHP Code:
<?php namespace App\Controllers\General;
    
    
// 200508
    
    
use CodeIgniter\Controller;
    
    
class Errors extends Controller {
        
    
public function index() {

        $header = [
            'css' => 'nodata',
            'title' => 'Page not found | wdeda'
        ];
    
        
echo view('templates/headerr'$header);
        echo view('content/error_404');
        echo view('templates/footerfb');
    
        
}

        
    
public function nodata() {


        $header = array(
            'css' => 'nodata',
            'title' => 'Invalid search argument | wdeda'
        );
        echo view('templates/headerr'$header);
        echo view('content/nodata');
        echo view('templates/footerfb');

    }

    public function nodatabkps() {
        $header = array(
            'css' => 'nodata',
            'title' => 'Search Results | wdeda'
        );
        echo view('templates/headerr'$header);
        echo view('content/nodata');
        echo view('templates/footerfb');
        
    
}

And finally, the view:
PHP Code:
<!-- 20200524 -->

<
div class="content-container">
<
div class="message">
<
img title="Oops" src="/assets/img/common/wd-20200416-oops.png"/>
<
span class="msgerror">ERROR 404page not found.</span>
<
h2>
What the f***!<br>
Houstonwe have a problem here.
</
h2>
<
h4>Sometimes this can happenSorry for the inconvenience.</h4>
</
div>
<
div class="links">
<
p><a href="http://localhost">Return to Homepage</a></p>
<
p><a href="mailto://[email protected]">Contact us to report a problem.</a></p>
</
div>
</
div
Reply


Messages In This Thread
RE: set404Override - setLocale not working? - by wdeda - 08-25-2021, 06:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB