07-21-2011, 10:34 AM
[eluser]StefanAlexandru[/eluser]
Hi everyone, I am new to CI, and I am trying to build up a classified site , so I've just encountered a problem which I couldn't understand.
So here is my code :
Controller :
Model:
So, when I am calling the controller like this :
http://www.domain.net/subdomain/ads/10/
I am getting a 404 error, but if I make a new function, not putting all the code in the index function, everything is working fine.
So my question is : Why I can't perform that actions in the index function of the controller ?
It wouldn't be a real problem but it's for seo purposes to haveinstead of
Thanks in advance and sorry for my bad english.
Hi everyone, I am new to CI, and I am trying to build up a classified site , so I've just encountered a problem which I couldn't understand.
So here is my code :
Controller :
Code:
<?php
class Ads extends CI_Controller {
public function index(){
$this->load->model('General');
$data['anunt']=$this->General->adbyID();
$this->load->view('anunt', $data);
}
}
?>
Model:
Code:
class General extends CI_Model {
function __construct() {
parent::__construct();
}
public function adbyID() {
$id=$this->uri->segment(2);
$this->db->where('postID', $id);
$query=$this->db->get('v_ads');
return $query->result();
}
}
So, when I am calling the controller like this :
http://www.domain.net/subdomain/ads/10/
I am getting a 404 error, but if I make a new function, not putting all the code in the index function, everything is working fine.
So my question is : Why I can't perform that actions in the index function of the controller ?
It wouldn't be a real problem but it's for seo purposes to have
Code:
http://www.domain.net/subdomain/ad/10/
Code:
http://www.domain.net/subdomain/ads/function/10/
Thanks in advance and sorry for my bad english.