Codeigniter: Call to undefined function base_url()

Claudio

Well-known member
Hi,

I get this error when I try to load base_url funcion. The problem is that I've already added base_url to autoload file but the issue still:
Code:
$autoload['helper'] = array('url');
views/home.php file has the following code:
Code:
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<div align="center">
    <h1>Index</h1>
    <a href="<?= base_url()?>">Link</a>
</div>

</body>
</html>
Any ideas? Since base_url function is being loaded by autoload I don't know what else should I try to do to fix this.

Thank you!
 
Hi,

I get this error when I try to load base_url funcion. The problem is that I've already added base_url to autoload file but the issue still:
Code:
$autoload['helper'] = array('url');
views/home.php file has the following code:
Code:
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<div align="center">
    <h1>Index</h1>
    <a href="<?= base_url()?>">Link</a>
</div>

</body>
</html>
Any ideas? Since base_url function is being loaded by autoload I don't know what else should I try to do to fix this.

Thank you!

Please try to add $this->load->helper("url") to the __construct() of your controller.
 
Top Bottom