Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Joomla 1 0 Component Tutorial v2007-04 Anetus

Joomla 1 0 Component Tutorial v2007-04 Anetus



|Views: 816|Likes:
Published by Ersun
cms joomla component tutorial 1.0.x version very good
cms joomla component tutorial 1.0.x version very good

More info:

Categories:Types, Research
Published by: Ersun on Jul 23, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





A tutorial explaining how simple component for Joomla! CMS 1.0 works, and how to create a component. One may wonder why to writeabout version 1.0 of Joomla!, when version 1.5 is almost ready (as of January 2007). I think version 1.0 is still a very good framework: onecan get to know how Joomla! works, extend the PHP knowledge, and prepare for Joomla! 1.5, which is a lot different and more advanced.And since there rather will not be upgrade possible from 1.0 to 1.5, just migration (hopefully a fast and easy one, thanks to greatdevelopers), there may be still a lot of existing web sites working on Joomla! 1.0 for quite some time.Official Joomla! web site contains a lot of useful information:
 There are of course tutorials of 
, and let's not forget about the most important part - security:
Guide to more secure components1. What is a component ?
Component is mini-application working in Joomla! enviroment. There are a few component included with Joomla! installation: com_banners,com_contact, com_content, com_weblinks and others. These core components cannot be uninstalled, of course.Components show information in frontend and backend, as Joomla! does.
2. Simplest component
The very simplest component has only two files:
 Downloadzip fileand install this sample component as usual in Joomla! Then create menu position pointing to the component. If there wereno errors during installation the component should work now - it should display either "you are not logged in" or "welcome back" if you arelogged in from frontend.Joomla! installer creates two folders for the component (com_simplest), and will put these files there:administrator/components/com_simplest/simplest.xmlcomponents/com_simplest/simplest.phpThe xml file is the "definition" file for the component - it contains details about it, list of files, SQL queries to perform during installation andafter uninstalling it.The php file is the actual frontend of a component.
3. Typical component files
The discussed component -JPortfSimple- has the following files:admin.jportfsimple.php1.admin.jportfsimple.html.php2.toolbar.jportfsimple.php3.toolbar.jportfsimple.html.php4.install.jportfsimple.php5.uninstall.jportfsimple.php6. jportfsimple.xml7. jportfsimple.class.php8. jportfsimple.php9. jportfsimple.html.php10.CSS / jp.css11.HELP / english.html12.IMAGES13.LANG / english.php14.During component installation there are two folders created within Joomla!:
 Anetus Ltd.www.anetus.comPage 1 of 21
in administrator/components/com_jportfsimple - files 1 to 7 are copied here, this is so called
andin components/com_jportfsimple - files 8, 9, 10 are copied here, this is
.Location of remaining folders with files (11 to 14) depends on a developer. Location of all the above files and folders is defined in XML file,which is read during installation.
4. XML file jportfsimple.xml
<?xmlversion="1.0"?>1. <mosinstalltype="component">2. <name>jportfsimple</name>3.<creationDate>2007/01/01</creationDate>4.<author>Konrad Gretkiewicz</author>5.<copyright>This component in released under the GNU/GPL License</copyright>6.<authorEmail>
</authorEmail>7.<authorUrl>www.anetus.com</authorUrl>8.<version>0.2</version>9.<files>10.<filename>index.html</filename>11.<filename>jportfsimple.php</filename>12.<filename>jportfsimple.html.php</filename>13.<filename>jportfsimple.class.php</filename>14.<filename>license.txt</filename>15.<filename>_readme.txt</filename>16.<filename>css/index.html</filename>17.<filename>css/jp.css</filename>18.<filename>images/index.html</filename>19.<filename>images/no_image.jpg</filename>20.<filename>lang/index.html</filename>21.<filename>lang/english.php</filename>22.</files>23.<install>24.<queries>25.<query>26.CREATE TABLE IF NOT EXISTS `#__jportfsimple_conf` (27.`id` INT NOT NULL AUTO_INCREMENT,28.`version` VARCHAR(20) NOT NULL,29.`base_path` VARCHAR(50) NOT NULL,30.`title` VARCHAR(100) NOT NULL,31.`description` TEXT NOT NULL,32.`css_file` VARCHAR(50) NOT NULL,33.PRIMARY KEY (`id`)34.) TYPE=MyISAM35.</query>36.<query>37.CREATE TABLE IF NOT EXISTS `#__jportfsimple_categories` (38.`id` INT NOT NULL AUTO_INCREMENT,39.`cat_name` TEXT NOT NULL,40.`cat_info` TEXT NOT NULL,41.`cat_path` TEXT NOT NULL,42.`meta_desc` TEXT NOT NULL,43.`meta_keywords` TEXT NOT NULL,44.`cat_image` TEXT NOT NULL,45.`cat_grp` int(11) NOT NULL default '0',46.`ordering` int(11) NOT NULL default '0',47.`access` TINYINT(1) NOT NULL default '0',48.`published` TINYINT(1) NOT NULL,49.PRIMARY KEY (`id`)50.) TYPE=MyISAM51.</query>52.<query>53.CREATE TABLE IF NOT EXISTS `#__jportfsimple_projects` (54.`id` INT NOT NULL AUTO_INCREMENT,55.`catid` TEXT NOT NULL,56.`name` TEXT NOT NULL,57.`description` TEXT NOT NULL,58.`meta_desc` TEXT NOT NULL,59.`meta_keywords` TEXT NOT NULL,60.`proj_image` TEXT NOT NULL,61.`proj_images_path` TEXT NOT NULL,62.`userid` int(11) NOT NULL default '0',63.`date` datetime NOT NULL,64.`ordering` int(11) NOT NULL default '0',65.`access` TINYINT(1) NOT NULL default '0',66.`published` TINYINT(1) NOT NULL,67.PRIMARY KEY (`id`)68.) TYPE=MyISAM69.</query>70.<query>71.INSERT INTO `#__jportfsimple_conf` VALUES (1,'0.2','images/stories/','JPortSimple','Sample description.','jp.css');72.</query>73.</queries>74.</install>75.<uninstall>76.<queries>77.<query>78.
 Anetus Ltd.www.anetus.comPage 2 of 21
DROP TABLE IF EXISTS `#__jportfsimple_conf`;79.</query>80.<query>81.DROP TABLE IF EXISTS `#__jportfsimple_categories`;82.</query>83.<query>84.DROP TABLE IF EXISTS `#__jportfsimple_projects`;85.</query>86.</queries>87.</uninstall>88.<installfile>89.<filename>install.jportfsimple.php</filename>90.</installfile>91.<uninstallfile>92.<filename>uninstall.jportfsimple.php</filename>93.</uninstallfile>94.<administration>95.<menu>jportfsimple</menu>96.<submenu>97.<menuact="categories">Categories</menu>98. <menuact="projects">Projects</menu>99. <menuact="configure">Configuration</menu>100. <menuact="info">About</menu>101. </submenu>102.<files>103.<filename>index.html</filename>104.<filename>admin.jportfsimple.php</filename>105.<filename>admin.jportfsimple.html.php</filename>106.<filename>toolbar.jportfsimple.php</filename>107.<filename>toolbar.jportfsimple.html.php</filename>108.<filename>logo.gif</filename>109.<filename>help/index.html</filename>110.<filename>help/english.html</filename>111.</files>112.</administration>113.<params>114.<paramname="back_button" type="list" default=""  label="Back Button" description="Show/Hide a Back Button, that returns you to the previous page">115.<optionvalue="">Use Global</option>116. <optionvalue="0">Hide</option>117. <optionvalue="1">Show</option>118. </param>119.<paramname="item_navigation" type="list" default="" label="Navigation Bar" description="Show/Hide the Navigation bar">120. <optionvalue="">Use Global</option>121. <optionvalue="0">Hide</option>122. <optionvalue="1">Show</option>123. </param>124.<paramname="display_num" type="list" default="50" label="Display Number" description="Number of items to be displayed by default">125.<optionvalue="6">6</option>126. <optionvalue="10">10</option>127. <optionvalue="16">16</option>128. <optionvalue="20">20</option>129. <optionvalue="25">25</option>130. <optionvalue="30">30</option>131. <optionvalue="50">50</option>132. </param>133.</params>134.</mosinstall>135.
lines 1 to 9 - basic component's information: name, author, version10 to 23 - frontend files24 to 75 - SQL queries creating new tables (CREATE) with necessary structure in database. Here 3 tables are created: jos_jportfsimple_conf (few configuration values), jos_jportfsimple_categories (for categories) and jos_jportfsimple_projects (for projects).#_ is replaced during installation with table prefix defined for your site (usually jos_). Last query (line 81) loads sample configurationvalues.76 to 88 - SQL queries run during uninstalling the component, removing old tables (DROP)89 to 94 - defines files to run after installing and uninstalling component96 to 102 - created backend menu, in Components103 to 112 - backend files114 to 134 - defines parameter which can be modified in menu position for given component
5. FrontendClass file
defines classes used in the component.
// no direct access
 Anetus Ltd.www.anetus.comPage 3 of 21

Activity (8)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
eleseberg liked this
Dhananjay Gautam liked this
shashankkanungo liked this
eliaspsi liked this
eliaspsi liked this
lazerRider liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->