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
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 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
https://github.com/kelvin-codes-stuff/InvoicePlane
This is my Fork, i donāt see why it wont load the controller
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
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
Check your PM @Kelvin_de_Reus , thereās a solution in there