joomla loadformdata

扶醉桌前 提交于 2019-12-06 05:09:45

try to overwrite getItem function.This will also be helpful if you are calling get('Item') in view. -

public function getItem($pk = null){
    if ($item = parent::getItem($pk)) {
        $db =& JFactory::getDBO();
        $query = $db->getQuery(true);
        $query->select('*');
        $query->from('#__project_part_1 AS a');
        $query->leftJoin('#__project_part_2 AS u ON a.uuid = u.uuid');
        $query->leftJoin('#__project_part_3 AS y ON a.uuid = y.uuid');
        $query->where('a.id = '. (int) $item->id);
        $db->setQuery($query);          
        $item =  $db->loadAssoc();
    }   
    return $item;
}

protected function loadFormData()
{
    // Check the session for previously entered form data.
    $data = JFactory::getApplication()->getUserState('com_web_projects.edit.webproject.data', array());

    if (empty($data)) {
    $data = $this->getItem();
    }

    return $data;
}

For Multi-Row Results use loadRowList(), loadAssocList(), loadAssocList($key), loadObjectList(), loadObjectList('key'). $db->loadResult() only load one result. Read more.

If I understand your question right this should fix your problem. If you not please ask.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!