[英]Grocery Crud display image from another table
我正在嘗試從另一個表中顯示雜貨雜貨編輯中的圖像。 提供的關系只是顯示文件名而不是圖像。 下面是我的代碼,讓我知道我需要更正的地方。 也不想更新我的編輯表(inwardinventory)中的圖像。 只需要根據從 mastersku 表中選擇 sacoskucode 列來顯示它。
public function entry()
{
$crud = new grocery_CRUD();
//$crud->set_theme('datatables');
$crud->unset_delete();
$crud->set_table('inwardinventory');
$crud->set_primary_key('SacoSku','inwardinventory');
$crud->set_relation('SacoSku','mastersku','SacoSku');
$crud->set_relation('PdtImage','mastersku','PdtImage');
$crud->set_field_upload('PdtImage','assets/uploads/files');
$crud->set_subject('In Out Stock');
$crud->field_type('TranscationType','dropdown',
array('IN' => 'Inward / Purchase','OUT' => 'Out Ward / Sale / Basement'));
$output = $crud->render();
$this->_example_output($output);
}
您可以提供帶有問題的表格結構,以便准確地給出答案;
根據雜貨雜貨網站的文檔,set_relation 函數接受參數:
set_relation($field_name,$related_table,$related_title_field)
如果您的數據庫架構是這樣的:
tblOne(id, refImageID)
tblImage(id, imagePath) 設置的關系函數必須是這樣的:
$crud->set_relation('refImageID','tblImage','imagePath');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.