Jump to content


I need dynamic tables name

relation

  • Please log in to reply
No replies to this topic

#1 Erick Tarzia

Erick Tarzia

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 07 June 2016 - 03: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.

 







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users