Welcome Guest, Not a member yet? Register   Sign In
Get image url from model good practice?
#14

(This post was last modified: 11-12-2015, 03:31 AM by sebastianvirlan.)

This should fix it cuz I return the view as data:

PHP Code:
   public function get_block_caracteristics(){
 
       if($this->nume_tip_proprietate == 'apartament')
 
           return $this->_ci->load->view('blocks/apartament', array('proprietate' => $this), TRUE);
 
       elseif($this->nume_tip_proprietate == 'teren')
 
           return $this->_ci->load->view('blocks/teren', array('proprietate' => $this), TRUE);
 
   

Yes you told me that to load views in controller but I need different view for each item from the object, and in this case I need to make a foreach to the object like this:

PHP Code:
$object $this->model->get_from_db();

foreach(
$object as $obj):
 
       if($obj->nume_tip_proprietate == 'apartament')
 
           $data['block']  = $this->_ci->load->view('blocks/apartament', array('proprietate' => $this), TRUE);
 
       elseif($obj->nume_tip_proprietate == 'teren')
 
           $data['block'] = $this->_ci->load->view('blocks/teren', array('proprietate' => $this), TRUE);
endforeach;

$this->load->view('page'$data); 

Then my controller will get a mess. This view have only few lines of html from the entire page
I made that explode because $class returned Proprietati_model.

The Proprietati model file was proprietati_model.php with class Proprietati_model.

And also how can I pass a param on the constructor's class?
Reply


Messages In This Thread
RE: Get image url from model good practice? - by sebastianvirlan - 11-12-2015, 03:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB