Welcome Guest, Not a member yet? Register   Sign In
base url
#1

[eluser]Unknown[/eluser]
hi to all!!!

m new with CodeIgniter and sorry in advance if i ask something wrong!!

actually i had set up the codeigniter on my local machine but when i reun my code i got some problem on my output screen...
in the following i have code for controller::


<?php

class myTry extends CI_Controller {

function __Constructor(){
$this->load->helper('url');}

public function index (){



if ($this->form_validation->run() != true ){


$this->load->view("abc");

}
else
{
echo "no registration is seen";
}
}

}
?>


and for the view i have the following code :::



<html>
<head>
<title>its view is called</title>
</head>
<body>

<form name="myform" action="<?php echo base_url('myTry/index');?>" method="post">

<label>User Name </label>
&lt;input type="text" /&gt;
<br />
<label> Password </label>
&lt;input type="text" /&gt;
&lt;input type="submit" value="submit" /&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;



after running the code i got the following error:::


The requested URL /CI/myTry/index was not found on this server.

if i got help from anybody then thnx in advance to the whole forum Tongue
#2

[eluser]Komeniusz[/eluser]
Controller name must start with upper case letter, try:
Code:
class MyTry extends CI_Controller {
#3

[eluser]CroNiX[/eluser]
You shouldn't really use "my" to start your classname unless you are extending a CI Core class. "my" has special meaning in CI and is best to be avoided unless you are using it as intended, which you aren't.

If you are going to do anything in your constructor, you must first tell it that the parent is also construct. __construct shouldn't be capitalized...

Code:
function __construct()
{
  parent::__construct();  //do this before any custom work
  $this->load->helper('url');
}

Are you using an htaccess to make CI work without "index.php" having to be in the URL?
What are the values of $config['base_url'] and $config['index_page']?
#4

[eluser]Unknown[/eluser]
@Komeniusz:::i have cover up this problem and got the same error. also in the root.php i have set the default root as the $route['default_controller'] = "MyTry";
but i got the same problem as mentioned in the post...
#5

[eluser]Unknown[/eluser]
@croNix:::: dear in the .htaccess file i have the following code....
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php



and this file is placed inside of the system folder of ci..
and also i was also trying by changing the name of the controller MyTry to Abc and for view AbcV but all in van!!!!Sad
#6

[eluser]InsiteFX[/eluser]
Only the Classname should be upercase the filename should be all lowercase
Code:
// filename ./application/controllers/mytry.php

//
['default_controller'] = 'mytry';

Also like CroNix mentioned to you above you should not use My as the beging of a Classname unless it is a MY_ type controller etc;
#7

[eluser]Unknown[/eluser]
@insite....nothing happen i have checked for all these stuff...in the routs.php i have change the route abc...my controller is now abc and controller class is Abc
#8

[eluser]InsiteFX[/eluser]
Make sure you do not have any white space in your files and do not use the ending php tag ?&gt;
#9

[eluser]Unknown[/eluser]
i check everything is go fine what ever u have said i also made my every code in the same manner but the problem is not solved




Theme © iAndrew 2016 - Forum software by © MyBB