User Rating: 1 / 5

Star ActiveStar InactiveStar InactiveStar InactiveStar Inactive
 

later to see the changes.

- edit files in the folder hello.php Edit Controllers Add Method.

Com_helloworld/Controllers/hello.php

function edit()
 {

      JRequest:setVar('view', 'hello');
      parent::display();

 

- Modify the files in the folder hello.php Models.

com_helloworld/models/hello.php

public function getItem()
{
        $pk = JRequest::getVar('cid');
        if(is_array($pk)) {
                $pk = $pk[0]; 
        }
        if($pk == '') {
                return false; 
        }
        $db = JFactory::getDbo();     
        $query = $db->getQuery(true);
        $query->select('*')
                ->from('#__helloworld_hello')
                ->where($db->quoteName('id').'='.$db->quote($pk));
        $db->setQuery($query);
        $db->query();
        return $db->loadObject(); // ส่งค่าออกไปในรูปของ Object
}
protected function loadFormData()
{
        $data = $this->getItem();
        return $data;
}
function save($data) 
{
        $db = JFactory::getDbo();
        $obj = (object) $data;
        try {
                if($obj->id) { 
                        $db->updateObject('#__helloworld_hello', $obj, 'id');
                } else {
                        $db->insertObject('#__helloworld_hello', $obj, 'id');
                }

        } catch (RuntimeException $exc) {                
                $this->setError($exc->getMessage());
                return false;
        }
        return true;
}

 

- Modify the files in the folder hello.xml models / forms to id is hidden.

com_helloworld/models/forms/hello.xml

<?xml version="1.0" encoding="utf-8"?>
<form>
        <fieldset name="hello_form">
                <field 
                        name="id"
                        type="hidden"
                />            
                <field 
                        name="name" 
                        type="text"
                        class="inputbox"
                        label="Name"
                        required="true"
                />
                <field 
                        name="detail" 
                        type="textarea"
                        class="inputbox"
                        label="Detail"
                        required="true"
                        rows="5"
                />
        </fieldset>
</form>

 

 

Chapter 13 - Delete Data Component Development

Recent Topics
Subject
Post Reply
Open
Recent
Features Review : Plugin Editors XTD Multicontent untuk mengeluarkan artikel dari Master Site ke Web Clien
By abdkode Tue 19 Feb 2019 6:52 pm Board Bahasa Language
0
6150
Tue 19 Feb 2019 6:52 pm By abdkode
Features Review : Mod MDFiles Popular modul menyenaraikan fail popular
By abdkode Tue 19 Feb 2019 5:41 pm Board Bahasa Language
0
5016
Tue 19 Feb 2019 5:41 pm By abdkode
Features Review : Mod MDFiles Featured memaparkan fail-fail yang dipilih dari MDFile untuk dipaparkan pada Joomla
By abdkode Tue 19 Feb 2019 4:39 pm Board Bahasa Language
0
2464
Tue 19 Feb 2019 4:39 pm By abdkode
Features Review : Components Mjform komponen untuk membuat borang laman web
By abdkode Tue 19 Feb 2019 3:23 pm Board Bahasa Language
0
2435
Tue 19 Feb 2019 3:23 pm By abdkode
Mod MDFiles Popular 모듈 소개 MDFile에서 파일을 가져와 표시
By wipaporn Fri 15 Feb 2019 6:06 pm Board korean Language - 한국어
0
5830
Fri 15 Feb 2019 6:06 pm By wipaporn
MDFiles Featured modules를 소개하면 MDFile에서 파일을 가져와 보여준다.
By wipaporn Fri 15 Feb 2019 6:06 pm Board korean Language - 한국어
0
5605
Fri 15 Feb 2019 6:06 pm By wipaporn
마스터 사이트에서 Web Client로 문서를 끌어오기 위한 플러그인인 Editors XTD Multicontent를 소개한다.
By wipaporn Fri 15 Feb 2019 5:48 pm Board korean Language - 한국어
0
1761
Fri 15 Feb 2019 5:48 pm By wipaporn
Joomla 1.5를 Joomla 2.5, 3.X로 업그레이드하기 위한 MJUpgrade 소개
By wipaporn Fri 15 Feb 2019 5:36 pm Board korean Language - 한국어
0
2151
Fri 15 Feb 2019 5:36 pm By wipaporn
MApplication Form Components를 소개한다. 구직 신청서는 웹사이트를 통해 작성된다.
By wipaporn Fri 15 Feb 2019 5:27 pm Board korean Language - 한국어
0
1954
Fri 15 Feb 2019 5:27 pm By wipaporn
Joomla 웹사이트 방문수를 집계하기 위한 "Mod vinaora visitors counter" 소개
By wipaporn Fri 15 Feb 2019 5:09 pm Board korean Language - 한국어
0
1889
Fri 15 Feb 2019 5:09 pm By wipaporn
유투브 동영상 및 클립매스 업로드를 위한 MVDO 플러그인 소개
By wipaporn Fri 15 Feb 2019 4:45 pm Board korean Language - 한국어
0
1672
Fri 15 Feb 2019 4:45 pm By wipaporn
Joomla 3.x 홈페이지에서 사진 갤러리를 만들기 위한 MD 갤러리 컴포넌트 소개
By wipaporn Fri 15 Feb 2019 4:36 pm Board korean Language - 한국어
0
1727
Fri 15 Feb 2019 4:36 pm By wipaporn
介绍了editors xtd multicontent,一个将文章从主网站拉入Webclien的插件。
By wipaporn Fri 15 Feb 2019 4:08 pm Board Chinese Language - 简体中文
0
10252
Fri 15 Feb 2019 4:08 pm By wipaporn
介绍MDFiles popular模块将mdfile中的文件显示出来
By wipaporn Fri 15 Feb 2019 4:08 pm Board Chinese Language - 简体中文
0
10326
Fri 15 Feb 2019 4:08 pm By wipaporn
介绍将joomla 1.5升级到joomla 2.5、3.x的 MJupgrade
By wipaporn Fri 15 Feb 2019 4:07 pm Board Chinese Language - 简体中文
0
10330
Fri 15 Feb 2019 4:07 pm By wipaporn
介绍MApplication Form Components工作申请表通过网站。
By wipaporn Fri 15 Feb 2019 4:07 pm Board Chinese Language - 简体中文
0
10459
Fri 15 Feb 2019 4:07 pm By wipaporn
介绍Mod Vinaora访客柜台,用于统计Joomla的网站访问量
By wipaporn Fri 15 Feb 2019 4:07 pm Board Chinese Language - 简体中文
0
18582
Fri 15 Feb 2019 4:07 pm By wipaporn
介绍用于上传youtube视频和clipmass的mvdo插件
By wipaporn Fri 15 Feb 2019 4:07 pm Board Chinese Language - 简体中文
0
10127
Fri 15 Feb 2019 4:07 pm By wipaporn
介绍Mod MDFiles Featured,将文件从MDfiles带到显示
By wipaporn Fri 15 Feb 2019 4:06 pm Board Chinese Language - 简体中文
0
25599
Fri 15 Feb 2019 4:06 pm By wipaporn
介绍用于在Joomla 3.x网站上创建照片库的MD Gallery Components
By wipaporn Fri 15 Feb 2019 4:06 pm Board Chinese Language - 简体中文
0
10633
Fri 15 Feb 2019 4:06 pm By wipaporn