⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

I need dynamic tables name



Erick Tarzia
  • profile picture
  • Member

Posted 07 June 2016 - 15:45 PM

My system need as dynamic table name, because every module have your table like: mod_facebook_like_box....

 

 

public function index() {
 
 
 
 
 
$this->grocery_crud->set_table ( 'modulos' );
 
$this->grocery_crud->set_relation ( 'tipo_de_modulo', 'componentes', 'titulo' );
$this->grocery_crud->field_type ( 'status', 'dropdown', array (
'0' => 'Despublicado',
'1' => 'Publicado' 
) );
$this->grocery_crud->field_type ( 'mostrar_titulo', 'dropdown', array (
'0' => 'Não',
'1' => 'Sim' 
) );
 
 
$this->grocery_crud->set_relation('configure',"{DYNAMIC FROM _get_table}",'title');
 
$output = $this->grocery_crud->render ();
 
$this->saida ( $output );
}
 
public function _get_table($value, $row){
$this->load->model ( 'modulos_model' );
$classe = $this->modulos_model->select ($row->tipo_de_modulo);
$tabela = "mod_" . strtolower ( $classe );
return $tabela;
}
 
 
Any sugestion?
Sorry for my english.