Welcome Guest, Not a member yet? Register   Sign In
simple link question
#1

[eluser]TomRac[/eluser]
Hi, I am new to CI but not to programming, and I am stumped by a simple link question!

I have created a link like this:

Code:
<a href="&lt;?php echo ROOT;?&gt;/search/register">New Registration</a>
located at: \application\views\iapsp\search.php, and I am attempting to link to the page registration.php located at: \application\views\iapsp\registration.php


Here is my controller page, located at: \application\controllers\search.php
Code:
&lt;?php
class search extends MY_Controller {
  
public function __construct()
       {
            parent::__construct();
            // Your own constructor code
   $this->load->library('email');
   $config['protocol'] = 'mail';
    $config['mailtype'] = 'html';
    $config['charset'] = 'utf-8';
    $config['wordwrap'] = TRUE;
    $this->email->initialize($config);
       }

function index()
{
      
    
  //$this->load->view('registration');
  $this->load->view('search');
}

  function register()
{
      
    
  $this->load->view('registration');
  //$this->load->view('search');
}

}
?&gt;

When I click on the link, the browser returns: Object not found!, and the URL points to: http://localhost/members/search/register

And in config/routes.php, I put this:

Code:
$route['default_controller'] = "search";
$route['404_override'] = '';

$route['page/(:any)'] = "page/$1";

Am I forgetting to do something?
#2

[eluser]ludo31[/eluser]
First of all , you write your name class in uppercase like

Code:
class Search extends CI_Controller {

       public function __construct()
       {
            parent::__construct();
          
       }
      
       public function index()
       {
          
          
       }

public function register ()
{

}
}

if you would catch the function register via anchor


Code:
echo anchor('search/register', 'Click here');
#3

[eluser]TomRac[/eluser]
where would I put this code?
#4

[eluser]Rolly1971[/eluser]
you can also do this:

Code:
<a href="&lt;?php echo site_url('search/register'); ?&gt;">New Registration</a>
#5

[eluser]TomRac[/eluser]
ok, it must be a configuration issue, because the browser is returning a 404 Page Not Found message

is there a config file which I might need to edit?? :question:
#6

[eluser]ludo31[/eluser]
have you make the configuration ???
sometimes we open : autoload , routes , database and etc to configure !!
may be you must read the doc !! and I recommend you to see that :

http://net.tutsplus.com/articles/news/co...tch-day-1/




Theme © iAndrew 2016 - Forum software by © MyBB