Step One:
Specify the name of the component. For example, components nyoba. Create a folder in a folder com_nyoba webname / components. Then, create two empty files. nyoba.php file and also nyoba.html.php file.
nyoba.php file is the file list of classes or functions. And the functions are created in the file nyoba.html.php. In making the joomla component must understand the concepts of OOP.
Step Two:
Open the file nyoba.php. Write the code like below:
defined( '_JEXEC' ) or die ( 'Restricted access' );
jimport('joomla.application.helper');
require_once(JApplicationHelper::getPath('html'));
jTable::addIncludePath(JPath_ADMINISTRATOR.DS.'components'.DS.$option.DS.'tables');
Don’t forget the beginning and end of coded file : <? php?>.
Step Three:
Write the following code nyoba.html.php file...
defined( '_JEXEC' ) or die ( 'Restricted access' );
jimport('joomla.application.helper');
jTable::addIncludePath(JPath_ADMINISTRATOR.DS.'components'.DS.$option.DS.'tables');
Step Four:
Open the file nyoba.php.
Write as a switch-case loop.
switch($task)
{
case 'home':
nyoba::home($option);
break;
default:
nyoba::home($option);
break;
}
Switch ($ task), considered as a link.
If we choose the home, to locate into the class nyoba - home function.
A content or programming of the class nyoba - home function, wrote in the file nyoba.html.php.
Step Five:
create a script in a file nyoba.html.php.
Write the classes and functions under the include’s
class nyoba
{
Function home()
{
Echo”hallo…..”;
}
}
Step Six (database):
Open phpmyadmin, open the joomla database, open the components table. Select insert.
Name --- name of the component (tried)
Link --- link on the web (option = com_nyoba)
Menuid --- 0
Parent --- 0
admin_menu_link --- option = com_nyoba
Admin_menu_alt --- Experiment
--- Option com_nyoba
Ordering --- 0
Admin_menu_img --- js / ThemeOffice / edit.png
Iscore --- 0
Params ---
Enabled --- 1
The components created, registered and entered into a database in joomla. Calling the component, headed the seventh step.
Step Seven:
Go to joomla administrator. Create an external link. Create a new menu, Nyoba. In the field Links insert: index.php? option = com_nyoba.
Tuesday, May 31, 2011
Create Joomla Component, Part 1
5/31/2011 05:45:00 AM
muis arghiansyach gp
No comments
0 komentar:
Post a Comment
Thanks a lot for your attention...