[eluser]tomclowes[/eluser]
Thanks for your responses.
In relation to 1, I have read your post - it makes a very interesting read. I have however not met problem such as yours. I have made absolutely no change to CodeIgniter and I can use $_POST['var']. Why would I ever use $this->input->post(’var‘)
2. This is the one that has caused me the most trouble - and getting a grip on it will help a lot. Basically I am struggling to get my head arround arrays etc within codeigniter and how they are passed from place to place.
My MY_Controller file contains:
Code:
$logged_in=$this->session->userdata('logged_in');
if($logged_in == TRUE)
{
$this->load->model('user_model'); //load model
$this->data['user'] = $this->user_model->user_details(); //get user details
}else{
$this->data['user'] = FALSE;
}
//THIS MAKES IT AVAILABLE IN ALL VIEWS/CONTROLLERS AS $user['username'] etc
$this->load->vars($this->data); //Make $this->data available to all views / controllers
Apologies for my idiocy here - this is my first usage of classes in production.
Code:
$this->user_model->user_details();
returns the user row as an array. I can access vars with
Code:
$this->data['user']['username']
for example.
Why does one not simply use:
Code:
$user = $this->user_model->user_details(); //get user details
then i can access things with
Anyway.. I assume the code above is the right approach.
Code:
$this->load->vars($this->data);
extracts the array per se.. but what is the process which means that trying to echo $user['username'] in my controller/model causes an error, but in my view files it works?
The idea of this is that I dont want to have to pass user details anywhere.. i want them to be everywhere.
3. Well that is essentially what I have done - I have coded the site, and am now sorting out the javascript. I am aware of the benefits of jquery but all my javascripts are simply things that I have seen online and implemented. My Javascript is completely abstracted, as is the simple files which process the results of the JS. Is this OK?
As an extra - my intention was to use these stand alone JS files, and then port to jquery as I have time to learn, appreciate and understand it. This somewhat links to 4. and CodeIgniter for PHP. It is like learning a new language because minimal knowledge of the base language is needed. A whole site based on CI and Jquery... what happens if they are both deprecated?
Thanks a lot !