1

I am stuck with what seem to be quite common. I have seen plenty of this questions so i know that is relates in some way to the others, however i still can not figure out why i am getting this error
I have latest codeigniter
My controller class

class AddLog extends CI_Controller {

public function __construct(){
    parent::__construct();
}
public function occupierLog_add(){
    $this->load->view('LogViews/LogIncident_Occupier/AddLogIncident');     
}
public function add_log(){
    $newLog = $this->input->post(null, true);
    var_dump($newLog);
}

}

my Index html

<html>
<head>
    <title>Hello</title>
</head>
<body>
   <a href="http://localhost/Concierge/application/controllers/Logs/AddLog.php/AddLog/occupierLog_add">Log Incident - Occupier</a>
</body>
</html>

So as you can see My Controller AddLog is inside contollers/Logs directory. In one of the methods i am trying to call view which is located in views/LogViews/LogIncident_Occupier/...

miken32
  • 42,008
  • 16
  • 111
  • 154
Maciej Cygan
  • 5,351
  • 5
  • 38
  • 72
  • Your link is completely wrong, you do not call a controller directly! (and not in _that_ way) You need to call it using a URL, please refer to the [manual](http://ellislab.com/codeigniter/user-guide/general/controllers.html) for basic routing – Damien Pirsy Oct 25 '13 at 12:41
  • @DamienPirsy i have looked into that, however i do not fully understand this – Maciej Cygan Oct 25 '13 at 12:51
  • 1
    refer this link http://stackoverflow.com/questions/7503302/how-to-get-base-url-in-codeigniter-2-0-2 – Anand Rajagopal Oct 25 '13 at 12:54
  • @Anand No, that has nothing to do with OP's problem, base_url() and being able to create a valid url to a controller are 2 different things – Damien Pirsy Oct 25 '13 at 12:59
  • @DamienPirsy will this be correct ?? http://localhost/Concierge/index.php/Logs/addlog/occupierlog_add .. it works as it should however is that correct way of doing ? – Maciej Cygan Oct 25 '13 at 13:01
  • Yes, that looks correct. Note that your "Addlog" controller now needs to be inseide the `Controller/Logs` folder (unless you routed the request). – Damien Pirsy Oct 25 '13 at 13:02
  • @DamienPirsy i haven;t routed it and its inside Logs folder. However i can now see what routing is, so will play around with it later on :) – Maciej Cygan Oct 25 '13 at 13:06
  • I would suggest renaming the Logs folder since there is already a Log folder present in CI installation which logs all error generated by application :) – Jigar Jain Oct 25 '13 at 15:46

1 Answers1

2

what version of CI are you using? because in 2.0 the controller super class is CI_Controller and in CI version 1 the controller super class is Controller

zion ben yacov
  • 715
  • 6
  • 13