Welcome Guest, Not a member yet? Register   Sign In
Beginner can't load Controller and Model (first day)
#1

[eluser]raymondS[/eluser]
Okay, i just started learning codeIgniter, and after i read the guides and the helpers and the class reference on my blackberry, i tried to run it on my pc after i got home.

So i Got XAMPP on my windows7 (C:\xampp\htdocs\), and codeIgniter to htdocs (C:\xampp\htdocs\LearningFrameWork), LearningFrameWork is my folder name.

Using Dreamweaver CS5, i tried to create a new site with these settings:

Local Site Folder : C:\xampp\htdocs\LearningFrameWork\
Server Folder: C:\xampp\htdocs\LearningFrameWork\
Web URL: http://localhost/LearningFrameWork/

Now i tried to run welcome.php on system\application\welcome.php, it can't load the Controller class.

(~_~). Can someone please tell me the problem ?
This is my first time using a framework (well i used jQuery, but codeIgniter is a lot more complicated).
#2

[eluser]raymondS[/eluser]
Fatal error: Class 'Controller' not found in C:\xampp\htdocs\LearningFrameWork\system\application\controllers\welcome.php on line 2



/*The Code on welcome.php*/

<?php
class Welcome extends Controller {

function Welcome()
{
parent::Controller();
}

function index()
{
$this->load->view('welcome_message');
}
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */
#3

[eluser]sortof_user[/eluser]
1- Have you checked the system/application/config/config.php file config['base_url'] to point to http://localhost/LearningFrameWork.

2-how do you request your page?
a)http://localhost/LearningFrameWork/welcome or
b) http://localhost/LearningFrameWork/syste...elcome.php

incase of b) then this is not proper and you get the above error. the proper way of calling MVC is
domain-name/controller/method/[params]
in your case it would be a) http://localhost/LearningFrameWork/welcome/

Please, elaborate more if the case was not resolved
#4

[eluser]raymondS[/eluser]
Still error.

if i use a)

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Error 404
localhost
5/23/2010 4:54:53 PM
Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0 mod_perl/2.0.4 Perl/v5.10.0

if i use b)

Fatal error: Class 'Controller' not found in C:\xampp\htdocs\LearningFrameWork\system\application\controllers\welcome.php on line 2

Really weird, all i did is just copy all the folders in codeIgniter to htdocs, then Using Dreamweaver CS5, i tried to create a new site with these settings:

Local Site Folder : C:\xampp\htdocs\LearningFrameWork\
Server Folder: C:\xampp\htdocs\LearningFrameWork\
Web URL: http://localhost/LearningFrameWork/

Then i just opened the welcome.php.
#5

[eluser]raymondS[/eluser]
It seems that welcome.php (on c:\xampp\htdocs\LearningFrameWork\controllers\welcome.php) can't find Controller Class (c:\xampp\htdocs\LearningFrameWork\libraries\Controller.php).
#6

[eluser]raymondS[/eluser]
config.php


if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$config['base_url'] = "http://localhost/LearningFramework";

/* The rest is unchanged */
#7

[eluser]raymondS[/eluser]
Hello, anyone can help me?

Could you tell me what to do if I use xampp?

Where to put the codeIgniter files?

And what to do the first time, the manual doesn't mention xampp.
#8

[eluser]Eric Barnes[/eluser]
If you visit: http://localhost/LearningFrameWork/index.php it should load the default controller. If you are getting a 404 error then check your permissions and you path to make sure it is correct.
#9

[eluser]yohanip[/eluser]
try to change
$config[‘base_url’] = “http://localhost/LearningFramework”;

to
$config[‘base_url’] = “http://localhost/LearningFrameWork”; //notice the uppercase "W"
#10

[eluser]raymondS[/eluser]
Can you guys please tell me what to do if i use xampp?

I don't even know what i'm doing wrong. All i did is just copy paste all codeIgniter files to htdocs and then i edit the config.php (i mention this earlier) and then tried opening http://localhost/LearningFrameWork/ (it works), but when i tried opening other files, there is always this error:

Fatal error: Class 'Controller' not found in C:\xampp\htdocs\LearningFrameWork\system\application\controllers\welcome.php on line 2

and other can't found Controller class. Sad




Theme © iAndrew 2016 - Forum software by © MyBB