Blog for Learning

| lesson material | material summary | questions and answers | definitions | types and examples | other information | materi pelajaran | ringkasan materi | pertanyaan dan jawaban | definisi | jenis-jenis dan contoh-contoh | informasi lainnya |

Powered by Blogger.

Pages

How to call the base_url () function in the file error_404.php on CodeIgniter

CodeIgniter - Farmer Code
When I modify the CodeIgniter 404 error page , the function base_url()cannot be called. Maybe this function is not recognized here. The function base_url()I need to insert the CSS code in the directory assetsError Message:
Call to undefined function base_url() in the error_404 page
The solution to this problem is very simple. We don't have to use the function base_url()to get the base url . We can use functions config_item()with parameters ‘base_url’Example:
<?php echo config_item(‘base_url’); ?>
Use to insert CSS Code:
<link rel=“stylesheet” href=”<?php echo config_item(‘base_url’) ?>/assets/AdminLTE/bootstrap/css/bootstrap.min.css”>
In addition to inserting assets , we can also use this function to link to the home page .
<body class=“bg-info”>
    <div class=“container”>
        <div class=“row”>
            <div class=“col-md-6 col-md-offset-3” style=“margin-top:16%”>
                <div class=“box box-warning animated shake”>
                    <div class=“box-body”>
                <h2><i class=“fa fa-warning”></i> 404 Tidak ditemukan</h2>
                <p>Halaman yang anda minta tidak ditemukan</p>

                <a href=“javascript:window.history.go(-1)”>Kembali ke Halaman Sebelumnya</a> |
                <a href=”<?php echo config_item(‘base_url’) ?>“>Kembali ke Home</a>
                </div>
                </div>
            </div>
        </div>
    </div>
</body>
The result:



Reference: https://www.petanikode.com/codeigniter-base-url-404/
0 Komentar untuk "How to call the base_url () function in the file error_404.php on CodeIgniter"

Silahkan berkomentar sesuai artikel

 
Template By Kunci Dunia
Back To Top