Get URL parameter

0

I need a code that when I click on the image, this image will open in a new tab. So far I've been able to do that when I click on top of my image it opens another tab with the path of the image in the URL. How do I get that path that is in the URL and make the image appear on my page, my code being in CodeIgniter and in MVC. This image is saved in my database.

The code I'm using to open the image is:

  function abreFoto(){
                window.open('<?= base_url('ControllerL/verFoto' + $l->foto_caminho ,'_blank'); ?>');
            }

My Controller:

public function verFoto($id) {
            $data['id'] = $id;
            $data['foto'] = $this->ML->getFoto($id);

        $this->load->view('ViewFoto', $data);
    }

My Model:

public function getFoto($id) {
        $this->db->select('fots.foto_id, fots.foto_caminho, laus.Laudo_id');
        $this->db->from('fots');
        $this->db->where('laus.Laudo_id', $id);
        $q = $this->db->get();
        return $q->result();
    }
    
asked by anonymous 01.07.2015 / 14:54

1 answer

1

To get URL parameters in Codeigniter, you use:

$this->input->get('nome_do_parametro'); 

You can get the parameter by the URI segment too:

$this->uri->segment(3); // Onde segmento 1 = controller; 2 = Método; 3+ = Parâmetros  

I hope you have helped

    
07.07.2015 / 12:46