Welcome Guest, Not a member yet? Register   Sign In
Controller Problems
#1

[eluser]ColinL[/eluser]
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?
#2

[eluser]gunter[/eluser]
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 :-)

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

[eluser]ColinL[/eluser]
Cheers for the reply. Smile

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

Code:
<?php

class Blog extends Controller {

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

?>
#4

[eluser]gunter[/eluser]
uh, thats tricky... this should work!!
if the file is at it´s right place I don´t know what´s wrong... :roll:
if you call ...index.php/welcome - then you see the welcome controller/view, right?
#5

[eluser]ColinL[/eluser]
Yeah, its stumped me. The file is the controllers folder, which I assume is the right place.
#6

[eluser]gunter[/eluser]
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... :coolsmirk:
I really don´t know anything other to do now...
#7

[eluser]ColinL[/eluser]
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.
#8

[eluser]gunter[/eluser]
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 ;-)

you have to change the config.php to:
Code:
$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!!
#9

[eluser]coolfactor[/eluser]
Yes, my first thought was IIS was the problem. Hopefully the changes that gunter suggested will help.
#10

[eluser]ColinL[/eluser]
Cool. Will give it a shot when I get home from work.

Cheers guys.




Theme © iAndrew 2016 - Forum software by © MyBB