0
J'utilise _remap:Utilisation de _remap avec des segments d'URL dynamiques
function _remap($method)
{
// $method contains the second segment of your URI
switch($method)
{
case 'hello':
$this->index();
break;
}
}
Je veux changer l'URL http://localhost/blog
-http://localhost/blog/hello
mon CI_Controller est:
class Blog extends CI_Controller {
function __construct()
{
parent::__construct();
}
function _remap($method)
{
// $method contains the second segment of your URI
switch($method)
{
case 'hello':
$this->index();
break;
}
}
/**/
function index()
{
$g_subject = $this->input->get('id', TRUE);
$query = $this->db->get_where('miniblog', array('id' => $g_subject));
foreach ($query->result() as $row)
{
$data = array(
'subject' => $row->subject,
'title' => $row->title,
'image_path' => $row->image_path,
'alt' => $row->alt,
'text' => $row->text,
'date' => $row->date,
);
}
$this->load->view('miniblog/blog', $data);
//add customer size to databe on customer
//$this->customer_size_model->show();
}
function ipv6()
{
$this->load->view('miniblog/ipv6');
}
}
Comment puis-je utiliser cela pour tout id dynamique et remplacer $row->subject
avec bonjour?