Welcome Guest, Not a member yet? Register   Sign In
controller function dont load
#1

[eluser]mehdy[/eluser]
my controller fuction is now working . but my index load perfectly.
config.php
$config['base_url'] = "http://localhost/codeigniter/";
$config['index_page'] = "";
route.php
$route['default_controller'] = "test";

my controller text.php
<?php


class Test extends Controller {

function Test()
{

parent::controller();
}

function index ()
{

echo $this->load->view('test');

}

function check (){

echo "ee";
}

}

my view file text.php

<html>
<head>
<title></title>
<meta http-equiv = "Content-Type" content = "text/html ; charset =UTF-8" >
</head>
<body>
<div id ="container" >

&lt;?php echo "gggg";

echo anchor('test/check' ,'new');

?&gt;
</div>
&lt;/body&gt;
&lt;/html&gt;


when i click link , it shows

The requested URL /codeigniter/test/check was not found on this server. please help me .
#2

[eluser]JHackamack[/eluser]
Unless you used mod rewrite to hide the index.php
$config[‘index_page’] = “”;
should be
$config[‘index_page’] = “index.php”;

and you should call:
/codeigniter/index.php/test/check
#3

[eluser]mehdy[/eluser]
thank you . but still no change .
my previous configuration
config.php
$config['base_url'] = "http://localhost/codeigniter/";
$config['index_page'] = "";

routes.php
$route['default_controller'] = "test";

autoload.php
$autoload['libraries'] = array('database','session','email','validation');

$autoload['helper'] = array('url','form','text','date','security');

htaccess.txt

RewriteEngine on
RewriteCond $1 !^(index\.php|images|captcha|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

/codeigniter/system/application/controllers/
i have connect with db ,
do i need to change any configuration ?
#4

[eluser]JHackamack[/eluser]
I see in your initial post you named your file "Text.php"
"my controller text.php "

but called the controller Test

Make sure both are the same file names
#5

[eluser]Rick Jolly[/eluser]
You are using a subdirectory. Add RewriteBase to your htaccess file. Also, try dropping the slash before "index.php/$1":
Code:
RewriteEngine on
RewriteBase /codeigniter/
RewriteCond $1 !^(index\.php|images|captcha|css|js|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
#6

[eluser]mehdy[/eluser]
thank you , yes i have chaged my htaccess file as u told , and my controller name is Test and file name is test , still no change , same error
#7

[eluser]JHackamack[/eluser]
Does it come back with:
http://localhost/codeigniter/test/check was not found?

is it the browser 404 error message or a code igniter styled error message?
#8

[eluser]mehdy[/eluser]
The requested URL /codeigniter/test/check was not found on this server.




Theme © iAndrew 2016 - Forum software by © MyBB