CodeIgniter Forums
Deleting the Home.php in Controller and Welcome_message - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Deleting the Home.php in Controller and Welcome_message (/showthread.php?tid=76209)



Deleting the Home.php in Controller and Welcome_message - shewolf255 - 04-22-2020

Hi there.

I just want to bring something under your attend,  and maybe I might be at fault here.

I am trying to build my very own cms and is busy using bootstap 4 for it and your online manual for cdi4. 

And here is the problem I have the online manual.

1) I want to to get rid of the Home.php controller and replace it with a Pages.php in the  controller and replace the welcome_message in the views folder. As per the online manual. But every time I try this I get the following message "Whoops, We seemed to have hit a snag. Please try again Later..." 

I have created a pages folder and have put inside that folder a home.php and a about_us.php files.

Please could you explain to me what I did wrong ? ( As i did copy the code from the codi4 website.)

Francois


RE: Deleting the Home.php in Controller and Welcome_message - John_Betong - 04-22-2020

Take a look and amend the ./apps/Config/Routes.php, rem out the welcome_message and add a route to the Pages Controller.


RE: Deleting the Home.php in Controller and Welcome_message - shewolf255 - 04-22-2020

(04-22-2020, 02:27 AM)John_Betong Wrote: Take a look and amend the ./apps/Config/Routes.php, rem out the welcome_message and add a route to the Pages Controller.
Hi John.


Please see the screen shot I have taken. 

I am doing my cms webpage dosing on my laptop. Do you think it could be a bit slow ?

Francois


RE: Deleting the Home.php in Controller and Welcome_message - John_Betong - 04-22-2020

I do not understand your comment.

Try adding echo __file__; die; to the /Controllers/Page.php, make sure it is being called then proceed slowly by revealing more script.


RE: Deleting the Home.php in Controller and Welcome_message - shewolf255 - 04-22-2020

(04-22-2020, 03:50 AM)John_Betong Wrote: I do not understand your comment.

Try adding echo __file__; die; to the /Controllers/Page.php, make sure it is being called then proceed slowly by revealing more script.
There is something not right in codeigniter.

There should be a way to get rid of the welcome_message.php in the view folder. So that you can start working on you home.php  file and etc  and I don't have a welcome message in the routes.php files.

I have also try and set the Pages.php as the default controller.

Francois


RE: Deleting the Home.php in Controller and Welcome_message - John_Betong - 04-22-2020

@shewolf255,
> There should be a way to get rid of the welcome_message.php in the view folder. So that you can start working on you home.php file and etc and I don't have a welcome message in the routes.php files.
>
> I have also try and set the Pages.php as the default controller.

From the supplied image I noticed that Home was replaced with Pages. Did you replace the other Home::index reference further below?

Code:
/**
* --------------------------------------------------------------------
* Router Setup
* --------------------------------------------------------------------
*/
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Home');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
$routes->setAutoRoute(true);

/**
* --------------------------------------------------------------------
* Route Definitions
* --------------------------------------------------------------------
*/

// We get a performance increase by specifying the default
// route since we don't have to scan directories.
$routes->get('/', 'Home::index');