Welcome Guest, Not a member yet? Register   Sign In
Passing GET value show error
#3

(This post was last modified: 10-01-2017, 03:39 AM by pippuccio76.)

(09-26-2017, 11:19 AM)PaulD Wrote: A redirect loads a controller path and file, not a view file. A load->view loads a view file, not a controller, so you cannot pass a date to a view file in the url like that.

Your load command is looking for a file called agenda/visualizza_settimana/2017-09-13.php in your views folder. I am guessing that you need to load your view something like agenda/visualizza_settimana/day_view (no .php required) from your controller class called Agenda, with a method called visualizza_settimana which is expecting a variable like $date, that you use to collect the data for the day_view and then load the day_view.

Agenda controller:
PHP Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');

class 
Agenda extends CI_Controller {

 
   public function visualizza_settimana($date)
 
   {
 
           // used date to get data you need to show
 
          $data = array('name'=>'Paul');

 
           // load your view
 
           $this->load->view('agenda/day_view'$data);
 
   }



day_view view file in a folder called 'agenda' inside the views folder, called day_view.php
PHP Code:
   <h1>Day View</h1>
 
   <p><?php echo $name?></p> 
Just html with the data you sent to the view displayed however you want.


Hope that helps, it seems complicated when you write it but it really is not.

Paul.

No , i dont understand , i have in another project the same problem :

I have a controller Documentazione this is a function :

Code:
  public function crea_documentazione_seconda($id) {

        $data = [];

        $record = $this->documentazione_model
                ->get_Documentazione($id);
       


        $data['res'] = $record;

        $this->form_validation->set_rules('id', 'Id', "required|trim|min_length[0]|max_length[10]", array('min_length' => 'Lunghezza minima id 0 caratteri', 'max_length' => 'Lunghezza massima id 10 caratteri', 'required' => 'id obbligatorio'));
        $this->form_validation->set_rules('data_consegna_dispositivo', 'Data_consegna_dispositivo', "trim|min_length[0]|max_length[10]", array('min_length' => 'Lunghezza minima data_consegna_dispositivo 0 caratteri', 'max_length' => 'Lunghezza massima data_consegna_dispositivo 10 caratteri'));
        $this->form_validation->set_rules('luogo_consegna', 'Luogo_consegna', "trim|min_length[0]|max_length[100]", array('min_length' => 'Lunghezza minima luogo_consegna 0 caratteri', 'max_length' => 'Lunghezza massima luogo_consegna 100 caratteri'));

        if ($this->form_validation->run()) {



            $res = $this->documentazione_model
                    ->editDocumentazioneSeconda(
                            $this->input->post('id'),          
                            $this->input->post('data_consegna_dispositivo'), 
                            $this->input->post('luogo_consegna')
            );

            if ($res) {

                $this->redirect('documentazione/crea_documentazione_terza/'.$record->id);

             
            } else {

    $this->load->view('templates/header', $data);
                   $this->load->view('templates/menu', $data);
                 $this->load->view('documentazione/crea_documentazione_seconda/'


               $this->load->view('templates/footer', $data);
            }
        } else {

            $this->load->view('templates/header', $data);
            $this->load->view('templates/menu', $data);

            $this->load->view('documentazione/crea_documentazione_seconda', $data);


            $this->load->view('templates/footer', $data);
        }
        

    }

I have also a view called : crea_documentazione_seconda.php in folder documentazione

It need a GET  value   because if form_validation->run()=FALSE i have this problem :

Message: Missing argument 1 for Documentazione::crea_documentazione_seconda()


How can i solve ?
Reply


Messages In This Thread
Passing GET value show error - by pippuccio76 - 09-26-2017, 09:00 AM
RE: Passing GET value show error - by PaulD - 09-26-2017, 11:19 AM
RE: Passing GET value show error - by pippuccio76 - 10-01-2017, 03:37 AM
RE: Passing GET value show error - by PaulD - 10-01-2017, 08:14 AM
RE: Passing GET value show error - by pippuccio76 - 10-01-2017, 08:32 AM
RE: Passing GET value show error - by PaulD - 10-01-2017, 08:46 AM
RE: Passing GET value show error - by pippuccio76 - 10-01-2017, 08:51 AM
RE: Passing GET value show error - by PaulD - 10-01-2017, 08:57 AM
RE: Passing GET value show error - by pippuccio76 - 10-01-2017, 09:03 AM
RE: Passing GET value show error - by Paradinight - 10-01-2017, 09:21 AM
RE: Passing GET value show error - by pippuccio76 - 10-01-2017, 09:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB