User Rating: 1 / 5

Star ActiveStar InactiveStar InactiveStar InactiveStar Inactive
 

Start building simple component

 

-create a folder com_helloworld in the Administrator/Components

-create a folder and files by topic.Chapter 6 - Introduction Component Development

-open the helloworld.php file and code this

com_helloworld/helloworld.php

 

<?php
defined('_JEXEC') or die('Restricted access'); 


if(!defined('DS')) {
        define('DS', DIRECTORY_SEPARATOR);
}


$c = JRequest::getVar('c');
if($c == '') {
        $c = 'hello'; 
}


$path = JPATH_COMPONENT_ADMINISTRATOR.DS.'controllers'.DS.$c.'.php';
if (file_exists($path)) {
        require_once $path;
} else {
      
        JError::raiseError('500',JText::_('JTUNKNOW_COMPONENT').' '.$c.' '.$path);
}

$classname = 'HelloworldController'.$c; 
$controller = new $classname(); 
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
?>

 

-Create a file in a folder named hellp.php controllers class name must be specified in the form of posts. Chapter 7 - Structure for building class Component Development.

Then enter the code com_helloworld/controllers/hellp.php

<?php
defined('_JEXEC') or die('Restricted access'); 

class HelloworldControllerHello extends JControllerLegacy 
{
        
     
        function display($cachable = false, $urlparams = array()) 
        {
      
                JRequest::setVar('view','hello');
                parent::display($cachable, $urlparams); 
        }
    
}
?>

 To create a display in the View by to create folders as we set the set the view controller in the controller will create a folder named hello hello and interior will create a file named. view.html.php And create a folder for files tmpl default.php layout to create a basic layout files first. 

com_helloworld /views/hello/view.html.php

<?php
defined('_JEXEC') or die('Restricted access');

class HelloworldViewHello extends JViewLegacy 
{

        function display($tpl = null)
        {
                parent::display($tpl);
        }
    
}
?>

 

com_helloworld/views/hello/tmpl/default.php

<?php 

defined('_JEXEC') or die('Restricted access');

?>

Hello world

 

Summary File

com_helloworld/helloworld.php

com_helloworld/controllers/hello.php

com_helloworld/views/hello/view.html.php

com_helloworld/views/hello/tmpl/default.php

 

 

Chapter 9 - Creating XML Form Component Development

Recent Topics
Subject
Post Reply
Open
Recent
介绍Component mFaceBook以帮助在Facebook上注册网站成员资
By wipaporn Wed 13 Feb 2019 3:20 pm Board Chinese Language - 简体中文
0
320
Wed 13 Feb 2019 3:20 pm By wipaporn
介绍Paytoread。插件只显示一些文本。
By wipaporn Wed 13 Feb 2019 3:17 pm Board Chinese Language - 简体中文
0
299
Wed 13 Feb 2019 3:17 pm By wipaporn
介绍插件MD水印(MD水印插件),自动水印插件
By wipaporn Wed 13 Feb 2019 3:15 pm Board Chinese Language - 简体中文
0
1048
Wed 13 Feb 2019 3:15 pm By wipaporn
Introducing Plugin MD Watermark, plug for automatic watermarking
By wipaporn Wed 13 Feb 2019 3:11 pm Board English Language
0
1353
Wed 13 Feb 2019 3:11 pm By wipaporn
Introducing PayToRead. The plugin shows only some text.
By wipaporn Wed 13 Feb 2019 3:08 pm Board English Language
0
1455
Wed 13 Feb 2019 3:08 pm By wipaporn
Introducing Component MFacebook to help with website membership registration with Facebook
By wipaporn Wed 13 Feb 2019 3:06 pm Board English Language
0
1423
Wed 13 Feb 2019 3:06 pm By wipaporn
Introducing Mrelated Article Specific Category Module (Storage browsing history).
By wipaporn Wed 13 Feb 2019 3:03 pm Board English Language
0
1579
Wed 13 Feb 2019 3:03 pm By wipaporn
Introducing Mod MDFiles Categories Module Bring Categories from MDFile.
By wipaporn Wed 13 Feb 2019 2:59 pm Board English Language
0
5327
Wed 13 Feb 2019 2:59 pm By wipaporn
Introducing the Mod MDFile recent module to show files from MDFile
By wipaporn Wed 13 Feb 2019 2:56 pm Board English Language
0
6591
Wed 13 Feb 2019 2:56 pm By wipaporn
Introducing MDFile Components for Joomla, helping to download document files on the website.
By wipaporn Wed 13 Feb 2019 2:49 pm Board English Language
3
2700
Wed 29 Apr 2020 11:49 am By mindphp
Features Review : Components MDFile membantu memuat turun fail dokumen di laman web.
By abdkode Wed 13 Feb 2019 2:37 pm Board Bahasa Language
0
1006
Wed 13 Feb 2019 2:37 pm By abdkode
Features Review : Mod MDFile recent Module yang menunjukkan fail yang diupload
By abdkode Tue 12 Feb 2019 6:45 pm Board Bahasa Language
0
1354
Tue 12 Feb 2019 6:45 pm By abdkode
Features Review : Plugin MD Watermark memudahkan dalam meletakan tanda air atau watermark
By abdkode Tue 12 Feb 2019 4:20 pm Board Bahasa Language
0
716
Tue 12 Feb 2019 4:20 pm By abdkode
这个(Pace)是什么?
By Parichat Wed 06 Feb 2019 7:25 pm Board Chinese Language - 简体中文
0
682
Wed 06 Feb 2019 7:25 pm By Parichat
pace 가 뭐죠?
By Parichat Wed 06 Feb 2019 7:25 pm Board korean Language - 한국어
0
464
Wed 06 Feb 2019 7:25 pm By Parichat
Mindphp webboard 등록하는 방법
By wipaporn Wed 06 Feb 2019 6:12 pm Board korean Language - 한국어
0
111
Wed 06 Feb 2019 6:12 pm By wipaporn
minephp webboard 注册方法
By wipaporn Wed 06 Feb 2019 5:49 pm Board Chinese Language - 简体中文
0
180
Wed 06 Feb 2019 5:49 pm By wipaporn
How to register minephp webboard
By wipaporn Wed 06 Feb 2019 5:30 pm Board English Language
0
350
Wed 06 Feb 2019 5:30 pm By wipaporn
Let's get to know Korea
By wipaporn Mon 04 Feb 2019 8:04 pm Board korean Language - 한국어
0
525
Mon 04 Feb 2019 8:04 pm By wipaporn
Let's get to know China
By wipaporn Mon 04 Feb 2019 8:03 pm Board English Language
0
395
Mon 04 Feb 2019 8:03 pm By wipaporn