User Rating: 1 / 5

Star ActiveStar InactiveStar InactiveStar InactiveStar Inactive
 

After adding later, do not fix it delete the data.

- Modify the files in the folder hello.php controllers add method delete.

com_helloworld/controllers/hello.php

function delete() 
{
        JRequest::checkToken() or die('Invaild Token');
        $cid = JRequest::getVar('cid');
        $model = $this->getModel('hello');
        foreach ($cid as $id) {
                if($model->delete($id)) {
                        $this->setMessage('Delete successfully');
                } else {
                        JError::raiseWarning('', 'Delete failed<br />'.implode('<br />', $model->getErrors()));
                }
        }

        $this->setRedirect(JRoute::_('index.php?option=com_helloworld&c=hello'));

 

- Modify the files in the folder models hello.php Add method delete.

com_helloworld/models/hello.php

function delete($id) 
{
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        try {
                $query->delete('#__helloworld_hello')
                        ->where($db->quoteName('id').'='.$db->quote($id));
                $db->setQuery($query);
                $db->execute();
        } catch (RuntimeException $exc) {
                $this->setError($exc->getMessage());
                return false;
        }
        return true;


 

Chapter 14 - Language file Component Development

Recent Topics
Subject
Post Reply
Open
Recent
Features Review : Components MCharts untuk memproses data dari MJForms menjadi graf
By abdkode Fri 22 Feb 2019 2:02 pm Board Bahasa Language
0
2530
Fri 22 Feb 2019 2:02 pm By abdkode
Features Review : Components MDBridge untuk menyambung data pengguna antara Joomla dan PHPbb Webboard
By abdkode Thu 21 Feb 2019 6:04 pm Board Bahasa Language
0
2706
Thu 21 Feb 2019 6:04 pm By abdkode
Features Review : MDEvents untuk mengurus pelbagai jadual data aktiviti
By abdkode Thu 21 Feb 2019 4:51 pm Board Bahasa Language
0
1726
Thu 21 Feb 2019 4:51 pm By abdkode
Features Review : Component MJUpgrade untuk menaik taraf Joomla 1.5 ke Joomla 2.5, 3.X
By abdkode Thu 21 Feb 2019 4:10 pm Board Bahasa Language
0
5716
Thu 21 Feb 2019 4:10 pm By abdkode
Features Review : Mod Mslideshows untuk memaparkan gambar, video Youtube dari kandungan
By abdkode Thu 21 Feb 2019 3:29 pm Board Bahasa Language
0
1270
Thu 21 Feb 2019 3:29 pm By abdkode
Plugin Editors XTD Multicontent 사용 지침과 설명
By wipaporn Thu 21 Feb 2019 12:28 pm Board korean Language - 한국어
0
9333
Thu 21 Feb 2019 12:28 pm By wipaporn
Module M Slideshows 사용 지침과 설명
By wipaporn Thu 21 Feb 2019 12:27 pm Board korean Language - 한국어
0
5045
Thu 21 Feb 2019 12:27 pm By wipaporn
Component M Multisite Master 사용 지침과 설명
By wipaporn Thu 21 Feb 2019 12:27 pm Board korean Language - 한국어
0
5255
Thu 21 Feb 2019 12:27 pm By wipaporn
Component M Multisite Client 사용 지침과 설명
By wipaporn Thu 21 Feb 2019 12:27 pm Board korean Language - 한국어
0
8199
Thu 21 Feb 2019 12:27 pm By wipaporn
MDFiles Featured 사용 지침과 설명
By wipaporn Thu 21 Feb 2019 12:26 pm Board korean Language - 한국어
0
9426
Thu 21 Feb 2019 12:26 pm By wipaporn
Module MDFiles Popular 사용 지침과 설명
By wipaporn Thu 21 Feb 2019 12:25 pm Board korean Language - 한국어
0
5757
Thu 21 Feb 2019 12:25 pm By wipaporn
Components MDFiles 사용 지침과 설명
By wipaporn Wed 20 Feb 2019 7:13 pm Board korean Language - 한국어
0
2255
Wed 20 Feb 2019 7:13 pm By wipaporn
Features Review : Mod Menu Json untuk menyemak Nama Domain dan memaparkan artikel dari master side
By abdkode Wed 20 Feb 2019 6:53 pm Board Bahasa Language
0
2133
Wed 20 Feb 2019 6:53 pm By abdkode
Module MDFiles Recent 사용 지침과 설명
By wipaporn Wed 20 Feb 2019 6:50 pm Board korean Language - 한국어
0
5411
Wed 20 Feb 2019 6:50 pm By wipaporn
Module MDFiles Categories 사용 지침과 설명
By wipaporn Wed 20 Feb 2019 6:41 pm Board korean Language - 한국어
0
5718
Wed 20 Feb 2019 6:41 pm By wipaporn
Features Review :Mod Lastnews json slider untuk ambil artikel dari Master Site dipaparkan di Web Client secara Slide.
By abdkode Wed 20 Feb 2019 6:11 pm Board Bahasa Language
0
2471
Wed 20 Feb 2019 6:11 pm By abdkode
Component MJForm 사용 지침과 설명
By wipaporn Wed 20 Feb 2019 5:59 pm Board korean Language - 한국어
0
5528
Wed 20 Feb 2019 5:59 pm By wipaporn
Features Review : M Multisite Content untuk mengedarkan data dari Master Site ke Webclient
By abdkode Wed 20 Feb 2019 5:23 pm Board Bahasa Language
0
5295
Wed 20 Feb 2019 5:23 pm By abdkode
使用 Plugin Editors XTD Multicontent 说明手册
By wipaporn Wed 20 Feb 2019 5:18 pm Board Chinese Language - 简体中文
0
16654
Wed 20 Feb 2019 5:18 pm By wipaporn
使用 Module M Slideshows 说明手册
By wipaporn Wed 20 Feb 2019 4:56 pm Board Chinese Language - 简体中文
0
20393
Wed 20 Feb 2019 4:56 pm By wipaporn