Welcome Guest, Not a member yet? Register   Sign In
Fatal Error: Class 'Controler' not found...
#1

[eluser]kaloyan[/eluser]
My first time with this, please help me solve the problem!
I write this code in notepad and save as "site.php" - all files, open with Chrome by typing "http://localhost/ci/index.php/site", and this error appears:

Fatal error: Class 'Controller' not found in C:\xampp\htdocs\ci\application\controllers\site.php on line 3

..the code:
<?php
class Site extends Controller
{
function index()
{
echo 'hello';
}
}
?>

Would You please help me?
Thank You!
#2

[eluser]Tpojka[/eluser]
Seems you have been using old tutorials that were describing code of version 1.7.2
There is difference between version, I asume you are using 2.1.4.
Feel free to check user guide (class is now called CI_Controller).
#3

[eluser]kaloyan[/eluser]
Thank You, for quick answer!
I am using version XAMPP 3.2.1, and 2.1.4 CodeIgniter.
So from ur answer, I understand that I should download the version shown in the tutorial or, look for a tutorial on my version. Smile

#4

[eluser]Tpojka[/eluser]
I don't even know really what subversion is used in development version so far,
but if you are begginer, you shouldn't use development version.
And there is no 'finding on internet', there is download version on this web site (best solution) and mirror files on github.
I recommend downloading from this site downloading area.
#5

[eluser]kaloyan[/eluser]
<This is the answer!>


http://path/to/codeigniter/index.php/<co...on>/<param>
So, in your case, it should be:

http://localhost/project1/CodeIgniter_2.....php/hello
$config['base_url'] should be set to the index.php, so it should be:

$config['base_url'] = 'http://localhost/project1/CodeIgniter_2.1.0/index.php';
DOCS: http://codeigniter.com/user_guide/general/urls.html

found it in stackoverflow...
#6

[eluser]Tpojka[/eluser]
I left you that answer in my first post here. You should check user guide.

Btw:
Code:
$config[‘base_url’] = ‘http://localhost/project1/CodeIgniter_2.1.0/’;
$config['index_page'] = 'index.php';
#7

[eluser]kaloyan[/eluser]
No, what guides do not seem to show is that "/CI/" in the URL, which this dude from stack.. showed when explaining how it works, but thank You for your attention on my question!


..I am reading the guide u send me right now, thanks.
#8

[eluser]Tpojka[/eluser]
Can you post stackoverflow link?

Edit code (not well qoutes posted before):
Code:
$config['base_url'] = 'http://localhost/project1/CodeIgniter_2.1.0/';
$config['index_page'] = 'index.php';
Also, I would recomend fresh copy of CodeIgniter for new project. It is 2.1.4.
#9

[eluser]kaloyan[/eluser]
Oh man, pls don't make me google it again, I'm sick and tired of this...two days searching for something so small, but causing so much trouble hahahaha Tongue, and btw...there is no reason...I simply copy-pasted his answer...that's just about all that he wrote.

http://localhost/ci/index.php/site - This is how the URL should be like...and in the guide they did not say about this "/ci/".

Yes I downloaded new copy of CI from the link u gave me, thanks!
#10

[eluser]kaloyan[/eluser]
Oh, and one more thing...don't know if it matters, but I had uploaded the index.php file in XAMPP route, but it has to be in CI route folder, right?

I remember that this was something that I did also.




Theme © iAndrew 2016 - Forum software by © MyBB