{"id":3235,"date":"2014-05-08T14:46:20","date_gmt":"2014-05-08T14:46:20","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2014\/05\/08\/helloworld\/"},"modified":"2023-06-07T15:10:34","modified_gmt":"2023-06-07T19:10:34","slug":"helloworld","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/","title":{"rendered":"Creating a Hello World Joomla 3 Component"},"content":{"rendered":"<p>In this tutorial we are going to create a <strong>Hello World<\/strong> component for Joomla 3.3. When we say, \u201c<em>create a component<\/em>\u201c, we mean:<\/p>\n<ol>\n<li>Create the files for the component<\/li>\n<li>Install the component<\/li>\n<li>View the component on the front end of the website<\/li>\n<\/ol>\n<h2>Creating the files for the <em>Hello World<\/em> component<\/h2>\n<ol class=\"article_list\">\n<li>Within your <em>Components<\/em> folder, create a folder named <strong>com_helloworld<\/strong><\/li>\n<li>Within your new <em>com_helloworld<\/em> folder, create a blank file named <strong>helloworld.xml<\/strong><\/li>\n<li>Within your new <em>com_helloworld<\/em> folder, create <strong>helloworld.php<\/strong> with the following code:\n<pre class=\"code_block\" style=\"margin-bottom: 10px;\">&lt;?php  echo \"Hello World\";<\/pre>\n<p>That\u2019s it! We\u2019ve just setup the following structure:<br>\n\u2022 com_helloworld\/helloworld.xml<br>\n\u2022 com_helloworld\/helloworld.php<\/p><\/li>\n<\/ol>\n<h2>Installing our <em>Hello World<\/em> component<\/h2>\n<ol class=\"article_list\">\n<li><a href=\"\/support\/edu\/joomla\/joomla-3\/how-to-log-in-to-administrative-dashboard\/\">Log into your Joomla admin dashboard<\/a><\/li>\n<li>In the top menu, click <strong>Extensions<\/strong> and then click <strong>Extension Manager<\/strong><\/li>\n<li>In the left menu, click the <strong>Discover<\/strong> <em>link<\/em><\/li>\n<li>In the top menu, click the <strong>Discover<\/strong> <em>button<\/em><\/li>\n<li>You will see <strong>com_helloworld<\/strong> show up in the list of avaialble extensions. Click the checkbox to the left of it, and then click the <strong>Install<\/strong> button in the top menu.You will see a few <em>Warnings<\/em> and <em>Messages<\/em> at the top of the page:\n<p style=\"font-size: 11px;\">\u2022 JInstaller: :Install: Cannot find Joomla XML setup file<br>\n\u2022 Component Install: The XML file did not contain an administration element<br>\n\u2022 Discover install failed: 10005<\/p>\n<p>For now, we will ignore these messages. We\u2019re doing very barebones testing, and our component is missing a few things, which in turn is triggering these messages to show.<\/p><\/li>\n<\/ol>\n<h2>Viewing our <em>Hello World<\/em> component<\/h2>\n<p><a href=\"\/support\/images\/stories\/edu\/joomla-3\/create-component\/first-hello-world-component-in-action.png\" rel=\"lightbox-0\"><img decoding=\"async\" class=\"std_ss\" style=\"float: right; margin: 0p 0p 15px 15px;\" src=\"\/support\/images\/stories\/edu\/joomla-3\/create-component\/first-hello-world-component-in-action.png\" alt=\"Hello World Component in action\"><\/a><\/p>\n<div style=\"clear: both;\"><\/div>\n<p>To see the <em>Hello World<\/em> component in action, visit your Joomla website and add the following at the end of your url:<br>\n<span style=\"color: red;\">index.php?option=com_helloworld<\/span><\/p>\n<p><strong>For example<\/strong>:<br>\nhttps:\/\/example.com\/<span style=\"color: red;\">index.php?option=com_helloworld<\/span><\/p>\n<p>When going to this url, Joomla will execute the helloworld component. It should look something similar to the screenshot to the right.<\/p>\n<h2>What have we learned?<\/h2>\n<h3>option=com_component identifies the component to load<\/h3>\n<p><a href=\"\/support\/images\/stories\/edu\/joomla-3\/create-component\/com_helloworld-in-url-and-folder-structure.png\" rel=\"lightbox-0\"><img decoding=\"async\" class=\"std_ss\" style=\"float: right; margin: 0px 0px 15px 15px;\" src=\"\/support\/images\/stories\/edu\/joomla-3\/create-component\/com_helloworld-in-url-and-folder-structure.png\" alt=\"Hello World in URL and Folder Structure\"><\/a><\/p>\n<div style=\"clear: both;\"><\/div>\n<p>If you set the <strong>option<\/strong> variable in the URL to <strong>com_<\/strong><em>something<\/em>, Joomla will see this as a request to load that component.<\/p>\n<p>https:\/\/example.com\/index.php?option=<span style=\"color: red;\">com_helloworld<\/span><\/p>\n<p>Looking at the URL above, Joomla knows we are requesting the <span style=\"color: red;\">com_helloworld<\/span> component to load. Joomla looks for this component in this folder: \/components\/<span style=\"color: red;\">com_helloworld<\/span><\/p>\n<h3>The first file loaded is <em>component<\/em>.php<\/h3>\n<p><a href=\"\/support\/images\/stories\/edu\/joomla-3\/create-component\/load-helloworld.php.png\" rel=\"lightbox-0\"><img decoding=\"async\" class=\"std_ss\" style=\"float: right; margin: 0px 0px 15px 15px;\" src=\"\/support\/images\/stories\/edu\/joomla-3\/create-component\/load-helloworld.php.png\" alt=\"Load Hello World component\"><\/a><\/p>\n<div style=\"clear: both;\"><\/div>\n<p>If you specify ?option=com_<span style=\"color: red;\">helloworld<\/span> in your URL, Joomla will load files from \/components\/com_<span style=\"color: red;\">helloworld<\/span>. Within that folder, Joomla will then load <span style=\"color: red;\">helloworld<\/span>.php.<\/p>\n<h3 style=\"clear: both;\">Case Matters \u2013 use lowercase<\/h3>\n<p>Use all lowercase when <strong>[1]<\/strong> naming your component\u2019s folder and <strong>[2]<\/strong> calling it in the URL.<\/p>\n<p>For example, <u>do not<\/u> name your folder <strong>com_<span style=\"color: red;\">H<\/span>ello<span style=\"color: red;\">W<\/span>orld<\/strong>. Also, do not use uppercase in your URL, like the following:<\/p>\n<p>https:\/\/example.com\/index.php?option=com_<span style=\"color: red;\">H<\/span>ello<span style=\"color: red;\">W<\/span>orld<\/p>\n<h3>Dashes and Underscores are acceptable<\/h3>\n<p>In our testing, in addition to naming the component \u201ccom_helloworld\u201d, we tested:<\/p>\n<ul>\n<li>com_hello<span style=\"color: red; font-weight: bold;\">\u2013<\/span>world \u2013 <em>uses a dash<\/em><\/li>\n<li>com_hello<span style=\"color: red; font-weight: bold;\">_<\/span>world \u2013 <em>uses an underscore<\/em><\/li>\n<\/ul>\n<p>In both situations, the components worked \u2013 so it\u2019s safe to say you can use dashes and underscores when setting up your component\u2019s name.<\/p>\n<h3>Uninstalling<\/h3>\n<p>If you followed along with our tutorial thus far, when you attempt to uninstall this component:<\/p>\n<ol>\n<li>The component files will be deleted successfull, however<\/li>\n<li>The component will still <em>linger<\/em> in the database. Simply use a tool like phpMyAdmin to remove the component from your <strong>_extensions<\/strong> table to clean if from your site.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial we are going to create a Hello World component for Joomla 3.3. When we say, \u201ccreate a component\u201c, we mean: Create the files for the component Install the component View the component on the front end of the website Creating the files for the Hello World component Within your Components folder, create<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/\"> Read More ><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4403,94],"tags":[4404],"class_list":["post-3235","post","type-post","status-publish","format-standard","hentry","category-joomla","category-joomla-3","tag-joomla-v3"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Creating a Hello World Joomla 3 Component | InMotion Hosting<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating a Hello World Joomla 3 Component | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"In this tutorial we are going to create a Hello World component for Joomla 3.3. When we say, \u201ccreate a component\u201c, we mean: Create the files for the component Install the component View the component on the front end of the website Creating the files for the Hello World component Within your Components folder, create Read More &gt;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2014-05-08T14:46:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-07T19:10:34+00:00\" \/>\n<meta name=\"author\" content=\"Brad Markle\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brad Markle\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/\"},\"author\":{\"name\":\"Brad Markle\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5ae05d1210b0ef63c437ccedce2799bf\"},\"headline\":\"Creating a Hello World Joomla 3 Component\",\"datePublished\":\"2014-05-08T14:46:20+00:00\",\"dateModified\":\"2023-06-07T19:10:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/\"},\"wordCount\":569,\"commentCount\":13,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"keywords\":[\"Joomla v3\"],\"articleSection\":[\"Joomla\",\"Joomla 3\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/\",\"name\":\"Creating a Hello World Joomla 3 Component | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2014-05-08T14:46:20+00:00\",\"dateModified\":\"2023-06-07T19:10:34+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating a Hello World Joomla 3 Component\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5ae05d1210b0ef63c437ccedce2799bf\",\"name\":\"Brad Markle\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/bradm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Creating a Hello World Joomla 3 Component | InMotion Hosting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/","og_locale":"en_US","og_type":"article","og_title":"Creating a Hello World Joomla 3 Component | InMotion Hosting","og_description":"In this tutorial we are going to create a Hello World component for Joomla 3.3. When we say, \u201ccreate a component\u201c, we mean: Create the files for the component Install the component View the component on the front end of the website Creating the files for the Hello World component Within your Components folder, create Read More >","og_url":"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2014-05-08T14:46:20+00:00","article_modified_time":"2023-06-07T19:10:34+00:00","author":"Brad Markle","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Brad Markle","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/"},"author":{"name":"Brad Markle","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5ae05d1210b0ef63c437ccedce2799bf"},"headline":"Creating a Hello World Joomla 3 Component","datePublished":"2014-05-08T14:46:20+00:00","dateModified":"2023-06-07T19:10:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/"},"wordCount":569,"commentCount":13,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"keywords":["Joomla v3"],"articleSection":["Joomla","Joomla 3"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/","url":"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/","name":"Creating a Hello World Joomla 3 Component | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2014-05-08T14:46:20+00:00","dateModified":"2023-06-07T19:10:34+00:00","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/joomla\/joomla-3\/helloworld\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"Creating a Hello World Joomla 3 Component"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5ae05d1210b0ef63c437ccedce2799bf","name":"Brad Markle","url":"https:\/\/www.inmotionhosting.com\/support\/author\/bradm\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=3235"}],"version-history":[{"count":8,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3235\/revisions"}],"predecessor-version":[{"id":104845,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3235\/revisions\/104845"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=3235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=3235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=3235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}