![]() |
What is causing the error in Codeigniter 4? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: What is causing the error in Codeigniter 4? (/showthread.php?tid=87256) |
What is causing the error in Codeigniter 4? - JohnMoncatkina - 03-30-2023 I am trying to load the booking.php file using Codeigniter 4, but encountering an error. I have added the required code to the Home Controller, but the page does not show up. When I call the file at sitename.com/booking, it returns an error. However, I am able to call index.php successfully. I am unable to call other URLs like /booking or /contact. Here is the code that I have added to the Home Controller: public function booking() { $this->load->view('Partials/home/head'); $this->load->view('Home/booking'); $this->load->view('Partials/home/foot'); } public function index() { echoview('Partials/home/head'); echoview('Home/index'); echoview('Partials/home/foot'); } RE: What is causing the error in Codeigniter 4? - JustJohnQ - 03-31-2023 Did you configure routes? RE: What is causing the error in Codeigniter 4? - HermyC - 03-31-2023 in CodeIgniter 4 you should use return view('Partials/home/head') .. CodeIgniter 3 $this->load->view('Partials/home/head') RE: What is causing the error in Codeigniter 4? - InsiteFX - 03-31-2023 Your using CodeIgniter 3 code where you should be using CodeIgniter 4 code. RE: What is causing the error in Codeigniter 4? - BremySohrax - 04-11-2023 Firstly, have you checked to make sure that the "booking.php" file is located in the correct directory and has the correct file name? Additionally, have you checked to make sure that the file permissions for the "booking.php" file are set correctly? Another thing to check is the routing configuration in CodeIgniter. Make sure that you have defined a route for "/booking" in the "app/Config/Routes.php" file. You can define a route like this: $route['booking'] = 'Home/booking'; If none of these solutions work, you may want to consider checking the error logs to see if there are any specific error messages that can help diagnose the issue. RE: What is causing the error in Codeigniter 4? - InsiteFX - 04-11-2023 PHP Code: echoview(); RE: What is causing the error in Codeigniter 4? - DempseyTorhan - 04-25-2023 It looks like you're having trouble loading the booking.php file using Codeigniter 4. From your code snippet, it seems that you have added the necessary code to the Home Controller. However, when you try to access the booking page at sitename.com/booking, you encounter an error. It could be that the URL is not configured properly in your routing file. Have you made sure that the route for the booking page is defined in your routes.php file? You can try adding the following line to your routes file: `$routes->get('booking', 'Home::booking');` This will map the URL `sitename.com/booking` to the `booking()` method in your Home Controller. Once you have added the route, you should be able to access the booking page without any issues. |