Welcome Guest, Not a member yet? Register   Sign In
Could any kind soul help me please?
#1

[eluser]zen333[/eluser]
I am new to CI and have very little knowledge on website programming. I followed the video tutorial on "Hello World" but got an error msg :Fatal error: Class 'Controller' not found in C:\wamp\www\CI\system\application\controllers\blog.php on line 3

My codes:
<?php

class Blog extends Controller {
}
function index()
{
echo 'Hello World'; }


?>

$config['base_url'] = "http://localhost/CI/"; and I have copied all my CI files to c:www/wamp.... Please help me! Thanks a million!
#2

[eluser]Dam1an[/eluser]
Hi, welcome to CI
Firstly, can you please use the [ code ] blocks in the future
Secondly, you have the closing brace for the class before you declare the index function, now I'm not sure if thats causing this particular problem, but it can't be heping

Also, did the default welcome page work when you first installed CI?
#3

[eluser]zen333[/eluser]
Hi Dam1an,

Many thanks for your reply. Yes the welcome page is working fine. I try to change the default loading at config.php to blog instead but it doesnt works too! Thanks I have corrected the error on the closing brace for the class but it still doesnt help and give the same error as before.....please help!
#4

[eluser]Dam1an[/eluser]
Hmmm... Thats very wierd... you've either changed something somewhere, or some quirk with wamp :-S
Try manually including the Controller, although you shouldn't have to
Add this to the top of your PHP file

Code:
include BASEPATH.'libraries/Controller.php';
#5

[eluser]zen333[/eluser]
THanks! but it still give the same error....I guess I have to reinstall everything if it helps! Sad
#6

[eluser]gtech[/eluser]
I think it might be the way you are accessing your page through the browser

for example

http://localhost/CI/system/application/c...s/blog.php

will result in the error your seeing


however

http://localhost/CI/index.php/blog/

should load the controller correctly
#7

[eluser]zen333[/eluser]
Hi gtech,

Thanks so much for your reply. Yes, I think that is the problem...I can view it now!!!Smile



Cheers!
Newbie




Theme © iAndrew 2016 - Forum software by © MyBB