base_url () function is not working ( Code ignitor)

67
June 08, 2021, at 3:10 PM

im new to php and recently im trying to load my html and css file into the code ignitor . Thus, my website wont load when i try to link between pages using href, id be so grateful if anyone can point out my mistakes, thankyou

this one is the view part where i want to link between pages

 <header>
    <nav>
            <ul>
                <li> <a href="<?= base_url()?> signup">Sign ups</a></li>    
          </ul>
    </nav>
</header>   

this one is the signup controller

<?php
class signup extends extends CI_controller{
public function index()
{
    $this -> load -> view ('header');
    $this -> load -> view ('signup_view');
    $this -> load -> view ('footer');
}
}
Answer 1

This looks like CI 2.x - if it's CI 3+ you need to titlecase your controller like in my code below. However, your issue is not loading the url helper. You can place it in the construct of your controller or right in the index function

<?php
class Signup extends extends CI_controller{
function __construct() {
  parent::__construct();
  $this->load->helper('url');
}
public function index() {
// ...

That will enable it in that controller, but you can enable it globally by placing this in your config/autoload.php file:

$autoload['helpers'] = array('url');
READ ALSO
input date - preselect year without setting value?

input date - preselect year without setting value?

<input type="date" name="birthday" id="birthdate" required="">

25
Bootstrap-Table: Using Ajax call and add link to output table

Bootstrap-Table: Using Ajax call and add link to output table

I am using bootstrap table to insert data via an ajax callHowever, I cannot format this data in the table

52
JupiterLab matplotlib line diagram is not mapped

JupiterLab matplotlib line diagram is not mapped

im trying to plot with matplotlib inJupiterLab a line graph:

57