• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
default controller eror??

#1
[eluser]anyamanggar[/eluser]
web.php
Code:
<?php

class Web extends CI_Controller{

public function __construct()
{
  parent::__construct();
  // Your own construct code
  
}


// ini untuk setting halaman utama
function index(){
$this->load->view('home_view');
}

// ini untuk setting about us
function about(){
  $this->load->view('about_view');
  }
  
// ini untuk setting services
function services(){
  $this->load->view('services_view');
  }

// ini untuk setting Health safety & environmental
function health(){
  $this->load->view('health_view');
  }
  
// ini untuk setting project list
function project(){
  $this->load->view('project_view');
  }

// ini untuk setting client
function client(){
  $this->load->view('client_view');
  }

// ini untuk organization chart
function organization(){
  $this->load->view('organization_view');
  }
  
// ini untuk setting contact us
function contact(){
  $this->load->view('contact_view');
  }
}

about_view.php
Code:
<?php $this->load->view('header_view'); ?>

header_view.php
Code:
<div id="logo">
<img src="&lt;?php echo base_url(); ?&gt;images/logo.png" width="900" height="120" /></div>
     <div class="menuatas">
<div id="myslidemenu" class="jqueryslidemenu">
<ul>
<li>&lt;?php echo anchor('','Home'); ?&gt;</li>
<li>&lt;?php echo anchor('about','About Us'); ?&gt;</li>
<li>&lt;?php echo anchor('services','Services'); ?&gt;</li>
<li>&lt;?php echo anchor('health','Health Safety & Environmental'); ?&gt;</li>
<li>&lt;?php echo anchor('project','Project List'); ?&gt;</li>
<li>&lt;?php echo anchor('client','Client'); ?&gt;</li>
<li>&lt;?php echo anchor('organization','Organization Chart'); ?&gt;</li>
<li>&lt;?php echo anchor('contact', 'Contact Us'); ?&gt;</li>
</ul>
<br />
</div>
</div>

the problem is, if make default controller with my controller web, and when i click menu for about i have got eror

Code:
404 Page Not Found

what wrong with that? can anybody know this? please help me, i am nubie

for htacess
Code:
<IfModule mod_rewrite.c>
   RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
    </IfModule>

config:
$config['base_url'] = 'http://localhost/mitra/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '.html';

route :

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

#2
[eluser]InsiteFX[/eluser]
Thats because you are missing the controller in your anchor tag
Code:
// anchor('controller/function')
&lt;?php echo anchor('web/contact', 'Contact Us'); ?&gt;

#3
[eluser]anyamanggar[/eluser]
Thank You

#4
[eluser]nebulom[/eluser]
You can also add a route

Code:
$route['contact'] = 'web/contact';


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.