CodeIgniter Forums
CodeIgniter doesn't load - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CodeIgniter doesn't load (/showthread.php?tid=59650)



CodeIgniter doesn't load - El Forum - 10-31-2013

[eluser]Unknown[/eluser]
I started with codeIgniter today, and I'm following the beginner tutorial from phpacademy.
Right now i got an odd problem. i got the following very simple controller:

Code:
<?php if ( ! defined('BASEPATH')) exit("No direct script access allowed");

class Site extends CI_Controller {
public function index()
{
}

public function home()
{
  $this->load->view("view_home", $data);
}

function about()
{
  $data['title'] = "About!";
  $this->load->view("view_about", $data);
}

function test()
{
  echo "test";
}
}

It always loads the index function fine. When i test it, it echo's whatever i want it to echo. But when i call the other functions nothing happens.

I didn't setup my .htacces yet, but when i visit the following adress:
http://localhost:8899/index.php/site/home

it doesn't load the home function. same goes for the other function ("about" and "test");

When i call one of the functions ("home", "about" and "test") from within the index() function it does call it how it should:
Code:
class Site extends CI_Controller {
public function index()
{
            $this->home();
}

public function home()
{
  $this->load->view("view_home", $data);
}

I'm not quite sure what is going wrong here. Hopefully someone can guide me in the right direction!


CodeIgniter doesn't load - El Forum - 10-31-2013

[eluser]Tpojka[/eluser]
Set constructor method too before all other methods and see what will happen:

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



CodeIgniter doesn't load - El Forum - 10-31-2013

[eluser]InsiteFX[/eluser]
Try setting up a route to it.

Code:
$route['site/(:any)'] = 'site/$1';



CodeIgniter doesn't load - El Forum - 11-01-2013

[eluser]Unknown[/eluser]
Thanks for the reply's! i found out the problem. For some reason screwed with the:
Code:
$config['uri_protocol

i had:

Code:
$config['uri_protocol'] = 'QUERY_STRING';

i has to be:
Code:
$config['uri_protocol'] = 'AUTO';


So this was the reason it wasn't calling my functions through the url's.