Skip to main content

tolong bantu para master... kok gga jadi2 hello world sya... -_-

September 16, 2011 by bayounk

bayounk's picture

class bayounk extends Controller {
	function bayounk () {
		parent::controller ();
	}
		function index () {
	echo "bayounk";
		}
	}
 

error nya ky gni.. knp yah???

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

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

BLS:

September 18, 2011 by syabac, 1 week 5 hours ago
Comment: 8980

syabac's picture

FYI, di CI 2.x
Controller base itu Namanya: CI_Controller
beda dengan di CI 1.x yg namanya : Controller

Model base juga sama,
CI 2.x CI_Model
CI 1.x Model

versi CI

September 17, 2011 by ijenk86, 1 week 1 day ago
Comment: 8972

ijenk86's picture

mending mas jelasin dlu mas pake CI versi brpa?
biar gg pusing yg mau ngasih tau nya. hehe,,
semangatttt

pake CI 2.0.3 mas... di

September 18, 2011 by bayounk, 1 week 1 day ago
Comment: 8973

bayounk's picture

pake CI 2.0.3 mas...
di paduin sma editor CI v 1.3 malah gga bisa, error pas buka editor CI'a... gga bisa buat new project, jadi project yg dlu yg kebuka.

tapi untuk nyoba hello world sya buat di editor notepad ++
masii error anehnya.... tolong pencerahan'a buat para master.. newbe sya.. trmksih

coba posting controller, view

September 18, 2011 by fanjava, 1 week 23 hours ago
Comment: 8974

fanjava's picture

coba posting controller, view ,kalo ada model..ya modelnya.
trus mas cra akses nya gmana?

biar kta2 bsa bntu n,n

$config['base_url'] =

September 18, 2011 by bayounk, 1 week 23 hours ago
Comment: 8975

bayounk's picture

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

ni kan buat confignya....

RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There area two reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router what URI segments to use if those provided
| in the URL cannot be matched to a valid route.
|
*/

$route['default_controller'] = "bayounk";
$route['404_override'] = '';

ini buat routenya...

class Bayounk extends Controller {
	function Bayounk () {
		parent::Controller ();
	}
		function index () {
	echo "bayounk";
		}
	}
 

ini file yg di controller, nama filenya bayounk.php

sya liat dr buku CI, cuma ini klo mau buat contoh seperti hello world, sya coba'a nampilin bayounk, pas hello world pun sama errornya seperti diatas mas...

kira2 apa yg kurang... makasih mas bantuannya ^^

Coba perhatikan cara akses URLnya

September 19, 2011 by fanjava, 6 days 6 hours ago
Comment: 8983

fanjava's picture

Coba mas perhatikan cara akses URLnya..
Kalau defaultnya CI harusnya diakses seperti ini :

http://localhost/index.php/controller/function/

Jadi mas mesti akses seperti ini, karena controllernya mas bayounk.

http://localhost/index.php/bayounk/

CMIIW

coba jawb

September 17, 2011 by fanjava, 1 week 1 day ago
Comment: 8971

fanjava's picture

it huruf dpannya ganti huruf besar.
kemudian, kemungkinan mas pake ci 2 ya?
kalo iya cob Controller it dganti CI_Controller.
dan terakhir coba, untk membuat konstruktor menggunakan __construct().

jdi kya gni...

class Bayounk extends CI_Controller {
function __construct () {
parent::__construct() ;
}
function index () {
echo "bayounk
}
}

kalo pake ci 1.7.x jadi kya gni...

class Bayounk extends CI_Controller {
function __construct () {
parent::__construct() ;
}
function index () {
echo "bayounk
}
}

semoga membntu :)
CMIIW

ga ada perubahan sama sekali

September 16, 2011 by bayounk, 1 week 2 days ago
Comment: 8969

bayounk's picture

ga ada perubahan sama sekali nih mas... penasaran kira2 dmnnanya ya yg salah... kyknya huruf kapital kan gga ngaruh yah??

itu huruf depan dari nama

September 16, 2011 by zawaruddin, 1 week 2 days ago
Comment: 8965

zawaruddin's picture

itu huruf depan dari nama class Controllernya harus Kapital, jadi

class Bayounk extends Controller {
	function Bayounk () {
		parent::controller ();
	}
		function index () {
	echo "bayounk";
		}
	}

dan usahakan nama file nya kecil semua bayounk.php

ga ada perubahan mas... masi

September 16, 2011 by bayounk, 1 week 2 days ago
Comment: 8970

bayounk's picture

ga ada perubahan mas... masi gtu ajj error commentnya,.,... penasaran nh...

Kalau pake versi 2.x,

September 18, 2011 by predhtz, 1 week 6 hours ago
Comment: 8979

predhtz's picture

Kalau pake versi 2.x, extendsnya bukan Controller, tapi CI_Controller

class Bayounk extends CI_Controller
{
function __construct()
{
parent::__construct();
}
...
}

cmiww.w.. bisa mas... mkasih

September 22, 2011 by bayounk, 3 days 23 hours ago
Comment: 9005

bayounk's picture

cmiww.w.. bisa mas... mkasih ternyata bner masalahnya ada di CI_Controller....

mksi banyak mass.... bravo CI ^^

Premium Drupal Themes by Adaptivethemes