繁体   English   中英

Grocery Crud 显示来自另一个表的图像

[英]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');
  • 为避免编辑 amage 并仅显示它,请添加行 $crud->fields(array("feilds", "to", "edit"));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM