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:

https://github.com/kelvin-codes-stuff/InvoicePlane

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