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
Template Megadeal of MooZiiCart for creating websites to sell products online
By prmindphp Fri 03 Apr 2020 6:45 pm Board English Language
0
61
Fri 03 Apr 2020 6:45 pm By prmindphp
Displaying products that customers are interested by Wishlist Module
By prmindphp Fri 27 Mar 2020 5:46 pm Board English Language
0
246
Fri 27 Mar 2020 5:46 pm By prmindphp
Show the Bestsellers Product by Module Bestseller
By prmindphp Wed 25 Mar 2020 6:04 pm Board English Language
0
131
Wed 25 Mar 2020 6:04 pm By prmindphp
Show Products Category by Module Category
By prmindphp Tue 24 Mar 2020 6:07 pm Board English Language
0
145
Tue 24 Mar 2020 6:07 pm By prmindphp
Plugin System MZC Auto Close to enable the open and close odering system
By prmindphp Wed 19 Feb 2020 6:38 pm Board English Language
0
2335
Wed 19 Feb 2020 6:38 pm By prmindphp
MDPartner Component for store client data in CRM system
By prmindphp Sat 25 Jan 2020 3:04 pm Board English Language
0
569
Sat 25 Jan 2020 3:04 pm By prmindphp
i am looking for help
By Anonymous Tue 14 Jan 2020 5:46 pm Board English Language
1
595
Tue 14 Jan 2020 6:03 pm By noppadonsk
Dot Net Training
By Poonaam Fri 10 Jan 2020 2:20 pm Board English Language
0
682
Fri 10 Jan 2020 2:20 pm By Poonaam
MDRental, Area management assistant for rental business
By prmindphp Wed 08 Jan 2020 6:51 pm Board English Language
0
567
Wed 08 Jan 2020 6:51 pm By prmindphp
Fix Gmail Error 404 By Taking Gmail Help Quickly
By Anonymous Wed 08 Jan 2020 2:56 pm Board English Language
0
579
Wed 08 Jan 2020 2:56 pm By Anonymous
How To Add New Facebook Friends using Facebook Phone Number?
By Anonymous Tue 07 Jan 2020 4:20 pm Board English Language
0
583
Tue 07 Jan 2020 4:20 pm By Anonymous
DBA Training Institute
By Shrutiii Wed 01 Jan 2020 3:06 pm Board English Language
0
599
Wed 01 Jan 2020 3:06 pm By Shrutiii
Tools for calculating the withholding tax easily reduce large tax
By prmindphp Wed 25 Dec 2019 6:56 pm Board English Language
0
586
Wed 25 Dec 2019 6:56 pm By prmindphp
Helper to calculate interest rates for investors
By prmindphp Tue 24 Dec 2019 6:52 pm Board English Language
0
647
Tue 24 Dec 2019 6:52 pm By prmindphp
Plan your savings easily with FV (Future Value) Calculator
By prmindphp Mon 23 Dec 2019 7:28 pm Board English Language
0
574
Mon 23 Dec 2019 7:28 pm By prmindphp
Payment Calculator, Installment calculation to make decisions
By prmindphp Fri 20 Dec 2019 6:00 pm Board English Language
0
613
Fri 20 Dec 2019 6:00 pm By prmindphp
Program Calculate Home Loan, Tools that will help you calculate home loans easily and quickly
By prmindphp Thu 19 Dec 2019 6:59 pm Board English Language
0
657
Thu 19 Dec 2019 6:59 pm By prmindphp
The website loads slowly ? The image size is not proportional, MImageoptimize Plugin of Joomla can help
By prmindphp Tue 17 Dec 2019 7:05 pm Board English Language
0
614
Tue 17 Dec 2019 7:05 pm By prmindphp
Calculation program Number of Periods (NPER)
By prmindphp Mon 16 Dec 2019 7:21 pm Board English Language
0
687
Mon 16 Dec 2019 7:21 pm By prmindphp
Calculation program after including VAT
By prmindphp Fri 13 Dec 2019 5:32 pm Board English Language
0
864
Fri 13 Dec 2019 5:32 pm By prmindphp