У меня есть две таблицы аттракцион и аттракцион_изображения.
attractions ------> id , title,description
attraction_images ----->attraction_images ----->attraction_id,attraction_image
Код: Выделить всё
public function attraction()
{
try{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('attractions');
$crud->set_subject('Attraction');
$crud->required_fields('title');
$crud->field_type('description', 'text');
$crud->columns('title','description','image');
$crud->callback_before_insert(array($this,'remove_special_char'));
$crud->set_field_upload('image','assets/uploads/files');
$crud->callback_column('image', array($this, 'callback_images'));
$output = $crud->render();
$this->_example_output($output);
}catch(Exception $e){
show_error($e->getMessage().' --- '.$e->getTraceAsString());
}
}
}
public function callback_images($value, $row)
{
$html = '';
$attraction= $this->db->get_where('attraction_images',array('attraction_id' => $row->id))->result_array();
if($attraction)
{
foreach ($attraction as $items)
{
$html.='';
}
}
$html.='';
return $html;
}
Я новичок в ImageCrud. Если кто-нибудь из друзей может мне помочь.
Спасибо
Подробнее здесь: https://stackoverflow.com/questions/307 ... image-crud
Мобильная версия