php - How to make Frontend_controller in codeigniter? -
i want create frontend_controller extend my_controller , extend ci_controller below code
in configure created __autoload function calling class name , file
function __autoload($classname) { if (strpos($classname, 'ci_') !== 0) { $file = apppath . 'libraries/' . $classname . '.php'; if (file_exists($file)) { @include_once($file); } } }
here wellcome pages
class welcome extends frontend_controler { public function __construct(){ parent::__construct(); } public function index() { $this->load->view('welcome_message'); } }
this frontend_controller
<?php class frontend_controler extends my_controler{ public function __construct(){ parent::__construct(); } } ?>
this my_controller
<?php class my_controler extends ci_controller{ public function __construct(){ parent::__construct(); } }
and create .htaccess
<ifmodule mod_rewrite.c> rewriteengine on rewritebase /test/ rewritecond %{request_uri} ^system.* rewriterule ^(.*)$ /index.php?/$1 [l] rewritecond %{request_uri} ^application.* rewriterule ^(.*)$ /index.php?/$1 [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?/$1 [l] </ifmodule> <ifmodule !mod_rewrite.c> errordocument 404 /index.php </ifmodule>
i got blank pages (white empty pages) when load website
what wrong code?
please advance!!!
here solution froentend_controller , my_controller i've change bellow work on linux hosting 1, renamed: file frontend_controller : frontend_controller 2, renamed: file admin_controller : admin_controller notes: have remember c first character of file name , class in file name have capital letter above centanc. , when extends other controller have call keep format
example: my_controller.php
class pages extends frontend_controller{ public function __contruct(){ parent::__construct(); } }
pages.php {pages controller}
class pages extends frontend_controller{ public function __contruct(){ parent::__construct(); } }
admin
class admin extends admin_controller{ public function __contruct(){ parent::__construct(); } }
note: if named file , class named wrong blank pages (empty pages) when load site
Comments
Post a Comment