Updated 001 Hello World with Joomla Component Builder (markdown)

Joseph Geller 2019-03-10 17:29:22 -05:00
parent 1cc4955cb7
commit bfe94fa092
1 changed files with 19 additions and 2 deletions

@ -17,9 +17,26 @@ There are many field types. We need to create a basic custom text field named gr
After creating a new field the next thing to do is create an admin view. This is what links fields to the database. Call it greeting for a single record and greetings for a list of records and greetings for a system name so that we can identify this across the system. I am going to add the greetings and a few generic icons. Then link that field we made to show, be the first one, act as a title, be sortable, be searchable and be a link in the first tab and first in that tab. Then give it permissions and save. The rest of the structure could be left as is. We will have a working component with this as an admin view so save and close.
Now we need to create a component Click on new and it loads a new Joomla component. I'm going to call it world. For the most part I'm just adding some test data here. I can select an icon. An image can be shown after installation of the component as well as in the admin area. The rest of the features in the settings that we need to change are the link to the admin view, select greetings, add to main menu, allow sub-menu, auto-checking, history, has metadata, has access, allow import and export. This next one is very important, add a create site view. That way in the site area it will be created for us. For the editing view, it will not create a list view. Edit and create greetings views will be created in the site area. We want this to be the first. There they are linked with the admin view. Click save and close and we are ready to compile our component.
Let's compile it. I am going to compile this and install it into Joomla. For installation, we don't some selections, so deselect these here and then compile. So just like that we have 8000 lines written and 160 pages. So That's way more than the hello world component we just looked at Now if we open the back end Are we having a store that we think you could install it via the Normal installer in fact let's Let's see if we can get that going So I've pasted the URL here that we find on this page here and we will take check and install. We have the hello world component installed and we can open here and go to hello world. We can go to the list and this is where a list of greetings will show. Click new and we can add some text let's say "Hi there James Sable". Close and there is our greeting. Open it and there it has a publishing structure that has permissions plus version control. So if we change this to "Hi there Michael", save and close it you will see that it updated. Open it and you can go to the versions. You can see that it is working. Open the previous version and you can see who changed it.
### Create Component Called World and Compile It
[03:51](https://youtu.be/1KBBtQUxMTc?t=263) **Create Component Called world** _Create an admin view and link fields to database_.
Now we need to create a component Click on new and it loads a new Joomla component. I'm going to call it world. For the most part I'm just adding some test data here. I can select an icon. An image can be shown after installation of the component as well as in the admin area. The rest of the features in the settings that we need to change are:
* The link to the admin view
* Select greetings
* Add to main menu
* Allow sub-menu
* Auto-checking
* History
* Has metadata
* Has access
* Allow import
* Allow export
This next one is very important, add a create site view. That way in the site area it will be created for us. For the editing view, it will not create a list view. Edit and create greetings views will be created in the site area. We want this to be the first. There they are linked with the admin view. Click save and close and we are ready to compile our component.
Let's compile it. I am going to compile this and install it into Joomla. For installation, we don't want some selections, so deselect these here and then compile. &&&&&&&&&&&&& So just like that we have 8000 lines written and 160 pages. So That's way more than the hello world component we just looked at Now if we open the back end Are we having a store that we think you could install it via the Normal installer in fact let's Let's see if we can get that going So I've pasted the URL here that we find on this page here and we will take check and install. We have the hello world component installed and we can open here and go to hello world. We can go to the list and this is where a list of greetings will show. Click new and we can add some text let's say "Hi there James Sable". Close and there is our greeting. Open it and there it has a publishing structure that has permissions plus version control. So if we change this to "Hi there Michael", save and close it you will see that it updated. Open it and you can go to the versions. You can see that it is working. Open the previous version and you can see who changed it.
All of this was done with just a few clicks and the result is a workable component which is now installed. If you look at the code you'll see the installer script of the hello world component. It adds the whole component into the content types and also into all the relevant areas. It also checks to see that we are at version 3.6 of Joomla!. It has also created the greeting table and modules. It has created helper structures. There is a helper class that was set up which has many features, functions and methods. Browse through the helper class in here if you know PHP. There is a very helpful method used in the code that grabs one value from the database. There are many functions in here which you can now use in your component by simply calling the helper class. This is what the application does and there is a MySQL folder with a few MySQL files, and one PHP file. It is very basic but JCB built hello world in a very short time. Look through this folder and learn the structures and exactly how you know you need to have the components.