Making a new page on InvoicePlane

Hi. So i want to add a page to the dashboard. Now i know PHP, HTML, JS etc but never worked on such a large project. I see that this works with controllers.

Now i added in: /application/modules/layout/views/includes/navbar.php the code to make a navbar item (with PHP echo anchor): <?php echo anchor('kc-custom/dashboard', "Dashboard"); ?>

Now i also made a folder: /application/modules/kc_custom. Now i made inside that a file: dashboard.php with some basic code: <h1> <?php echo date("Y"); ?> </h1>

Now when i click on the dropdown item it’s gives a 404 :frowning:
What do i need to do it reconizes the file?

Did you make a controller, that requests your view?
Just take a really, really close look at for example the ‘clients’ module.
It has a model, view and controller: MVC.
Start eith your controller and your view.

1 Like

Hi, no i did not, then that’s it why it isn’t working. Gonna look into it! I see its made with Codeigniter Framework, gonna read into that also!

(Update, its working!)

Hi, so its working!

Hi, so this is weird. It works local in VScode. But when i put everything on the server its says “The page you requested was not found.” again. I tripple checked and everything is the same as the local version. (except SSL is enabled on the production version on the server) and that i have it in a sub dir

My controller (working on local version):

<?php


if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}


class Kelvincodes extends Admin_Controller {

    // Testing
    public function testing() { 
        echo "Hi i do workie workie!";
    } 

    // Main page
    public function dashboard(){
        $this->layout->buffer(
            array(
                array('content', 'kelvincodes/view')
            )
        );        
        $this->layout->render();
        $this->load->view('kelvincodes/dashboard'); 

    }


} 

Did you run composer dump-autoload -o on the server? Are you able to run that command or is the server not allowing you to do that?

Hi, so i did do that and i got as an response:
“Generating optimized autoload files
Generated optimized autoload files containing 808 classes”

Now it didn’t help sadly. I’m trugling with this a long time. It looks like it doesn’t reconize the controller or something. ALso there isn’t something inside the error logs either :frowning:

This is my Fork, i don’t see why it wont load the controller :confused:

I also did remove vendor on the server and runned “composer install” without issues, but it keeps saying “The page you requested was not found.” while it works local still :confused:

So i just tested with the most basic folder structure and controller local and then on the server:

<?php


if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}

class Kelvin extends Admin_Controller {

    // Testing
    public function testing() { 
        echo "Hi";
    } 

}

This works local on my machine and again not on the server. I dont understand it (i did run your command composer dump-autoload -o)

I’ll take a look when i have time

Sure! :slight_smile:

Check your PM @Kelvin_de_Reus , there’s a solution in there

Its solved!

1 Like