EllisLab text mark
Advanced Search
     
Controller Problems
Posted: 02 September 2007 01:10 PM   [ Ignore ]
Joined: 2007-09-02
8 posts

Hey all. New to CodeIgniter, and already running into problems. Just got done installing/configuring CI, and went ahead and started going through the video tutorials. But right off the bat, I’ve hit a snag. I’ve created the Blog controller shown in the first video tutorial, but when I go to my browser, instead of seeing “Hello World” I get a Page Cannot Be Found error.

I’m running it locally, with IIS 5.1, MySQL 5 and PHP5. Anyone got anyideas what’s causing the problem?

 
Posted: 02 September 2007 01:56 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2006-04-27
198 posts

has the file, the class and the constructor the same name?
check out, if you can echo something in the constructor, or in the index function….
or, show us your controller grin

another idea is to copy the welcome controller and change it to your needs

 
Posted: 02 September 2007 01:59 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2007-09-02
8 posts

Cheers for the reply. smile

The file is called blog.php and the class is called Blog. The actual controller is as follows:

<?php

class Blog extends Controller {

   
function index()
   
{
      
echo 'Hello World';
   
}
}

?> 
 
Posted: 02 September 2007 02:17 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2006-04-27
198 posts

uh, thats tricky… this should work!!
if the file is at it´s right place I don´t know what´s wrong… rolleyes
if you call ...index.php/welcome - then you see the welcome controller/view, right?

 
Posted: 02 September 2007 02:19 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Joined: 2007-09-02
8 posts

Yeah, its stumped me. The file is the controllers folder, which I assume is the right place.

 
Posted: 02 September 2007 02:46 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2006-04-27
198 posts

so I cannot figure out why it´s not working - the constructor is not necessary if you don´t need a constructor I think… - don´t know…
then, if the welcome controller is working then I would copy it to blog.php and change all welcome´s to blog…  cool smirk
I really don´t know anything other to do now…

 
Posted: 02 September 2007 02:49 PM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Joined: 2007-09-02
8 posts

Hmm. This maybe of help. Just went to try the welcome controller in my browser, and the samething is happening. Getting a page cannot be found error.

 
Posted: 04 September 2007 02:07 PM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Avatar
Joined: 2006-04-27
198 posts

uh, sorry! Just now I saw that you are using IIS…

please do this:
http://ellislab.com/forums/viewreply/220662/

or search for postings with IIS and index.php problems wink

you have to change the config.php to:

$config['index_page'"index.php?";
$config['uri_protocol']    "auto"// or maybe some other settin? 

and I think you have to use: ..../index.php?/welcome to call the welcome controller.
good luck!!

 
Posted: 04 September 2007 02:26 PM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Avatar
Joined: 2006-06-23
370 posts

Yes, my first thought was IIS was the problem. Hopefully the changes that gunter suggested will help.

 Signature 

Mac OS X 10.8, Apache 2.x, NGiNX, PHP 5.4.x, CodeIgniter 1.7.2/2.1.3

 
Posted: 04 September 2007 05:33 PM   [ Ignore ]   [ # 9 ]   [ Rating: 0 ]
Joined: 2007-09-02
8 posts

Cool. Will give it a shot when I get home from work.

Cheers guys.

 
Posted: 05 September 2007 10:53 AM   [ Ignore ]   [ # 10 ]   [ Rating: 0 ]
Joined: 2007-09-02
8 posts

Great, it seemed to work a treat.

Cheers everyone.