Updated 040 Adding Helper Structures to any JCB component (markdown)

Amigo 2019-08-02 12:35:37 +02:00
parent dd9538033f
commit 27d685e48c
1 changed files with 10 additions and 6 deletions

@ -32,7 +32,7 @@ If Demo is opened, it may be seen that it has this new Help Documents area. At t
[00:06:41](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m41s)
This is usually what will be used when a component gets shipped . Since this will then give the opportunity to link it to an external URL which can be updated and edited without sending an update or an upgrade to the component. The help pages can be changed which were linked them. This is how JCB has been setup. JCB is linking to an external Help Structure but you can decide whatever you want to do with this component.<<<<<<<<<
This is usually what will be used when a component gets shipped . Since this will then give the opportunity to link it to an external URL which can be updated and edited without sending an update or an upgrade to the component. The help pages can be changed which were linked them. This is how JCB has been setup. JCB is linking to an external Help Structure but you can decide whatever you want to do with this component.
* ### Type - Text
@ -41,22 +41,26 @@ This is usually what will be used when a component gets shipped . Since this wil
For example: 'Text' can be used, and "This is the help you need" can be typed in or whatever. Save and close. If 'Looks' is opened, a new button called 'Help' is shown. If it is used it opens that 'Help'. [00:07:47](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m47s) Go back and click 'New' then that 'Help menu' will not be displayed anymore. You can close , and go back to the 'Help Documents' and create another one. Again a specific group may be targeted , or all groups can be targeted. Again at Admin area. The Site area can also be targeted, and it is possible to link it to any of the front end areas. [00:08:32](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m32s) It may be decided not to target the list(Looks), but the edit area(Look) which is singular. Again a title may be given to it. In this instance link it to an URL. Save and close. Then in the 'Looks' area, add New, and now it can be seen that area also has a Help button. When the help button is used, it opens that URL in a pop-up, and as may be seen a video is selected .[00:09:13](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m13s) That is how to link to other external sources to give instructions that is necessary(Help) to a specific page.
### System Name
* NB.Remember to Compile Before Install
[00:09:36](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m36s)
Having set up a few Help Menus for the Component you can go back to Component Builder and to the Admin View Area. If for instance a Help Document is linked to Component Demo, and you want to ship it with the information that you have created as 'Help' inside of the Component. What needs to be done, is to open this Admin View, and give it a system name of 'Demo'. Then go to MySQL(add MySQL), and indicate by 'Yes' that it should be linked.<<<
Having set up a few Help Menus for the Component you can go back to Component Builder and to the Admin View Area. If for instance a Help Document is linked to Component Demo, and you want to ship it with the information that you have created as 'Help' inside of the Component. What needs to be done, is to open this Admin View, and give it a system name of 'Demo'. Then go to MySQL(add MySQL), and indicate by 'Yes' that it should be linked.[00:10:31](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m31s) Select MySQL source - Table. Go to the Demo Table and select a Table. Select 'demo_help_document', and remove some of the values that is not necessary.(See video) Save and close. It may be saved or saved as copy. If I have another component, I will copy Help Document(demo) and link it to that components database.
**NB. When this is done, first compile the component before you uninstall the local component.**
[00:10:31](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m31s) I'll select MySQL source - Table. I would go to the Demo Table, select a Table. You see demo_help_document click on that, and I'll just remove some of the values that I know is not necessary.(See video) Created modified and version can stay. Save and close. I can save this or save as copy. If I have another component, I'll copy Help Document(demo) and link it to that components database. The only thing to remember when you've done this [00:11:36](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m36s) Is it is you must first compile the component before you uninstall the local component. First come here(Compiler) and compile that(demo) component.
First go to Compiler and compile that Demo component.
### Insert Tables - Linking Table To Component
Let me quickly show you in the code what is happened. I've opened com_demo_v2_0_0_J3.zip package of a component. Go to Admin area, then to sql. Then I go to the install.mysql.utf8.sql document. Double clicked on that. It open this document. You'll see that they has [00:12:25](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m25s) Insert Table. It also has Insert Data that we created. There is 'this is the help you need', there's a URL I added. It will insert this data into the database when this component is installed. [00:12:50](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m50s) Having done those changes and linking the table to the component, it goes to the database and extract these values and places into the dump file of the Component. It does not place it into the update file, just that you know. That means that if users already have your component installed and they install this, it will not add these helper structures, you'll have to use Custom Scripting in the Joomla Component Area in the PHP tab. There is a place for update and uninstalled and installed [00:13:40](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m40s) to add Custom PHP Script, where you can insert this data into the Database.
[00:11:57](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m57s)
What has happened in the code? If the 'com_demo_v2_0_0_J3.zip' package of a component is opened. Go to 'Admin area', then to 'sql'. Then to the 'install.mysql.utf8.sql' document. Double click on that. It open this document. [00:12:25](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m25s) 'Insert Table' can be seen. It also has 'Insert Data' that we created. There is 'this is the help you need', there is a URL which I added. It will insert this data into the database when this component is installed. [00:12:50](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m50s) Having done those changes and linking the table to the component, it goes to the database and extract these values and places into the dump file of the Component. Keep in mind that it did not place it into the Update file. That means that if users already have your component installed and they install this, it will not add these Helper structures, you will have to use Custom Scripting in the Joomla Component Area in the PHP tab. There is a place for update and uninstalled and installed to add Custom PHP Script, where you can insert this data into the Database.
### What Happens If Component Is No Longer Installed?
I'm going to show you what happens if the component is no longer installed, and you try to compile it. The first thing is I'm going to quickly uninstalled the Demo Component. I'm going to go to the compiler. I'm going to try and compile Demo Component. It will give 'An error has occurred'. It's telling you that it couldn't find "Table 'demo.#_demo_help_document'doesn't exist". [00:14:24](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m24s) It couldn't find that table because you uninstalled it. The only way to compile this component would be to go back to the Admin View, and delink the component from the table.
[00:13:48](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m48s)
To illustrate what happens if the component is no longer installed, and a attempt is made to compile it: First thing is to uninstall the Demo Component. Then go to the compiler and try and compile Demo Component. It will indicate 'An error has occurred' and that it could not find "Table 'demo.#_demo_help_document'doesn't exist". [00:14:24](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m24s) It could not find that table because it has been uninstalled. The only way to compile this component would be to go back to the Admin View, and 'delink' the component from the table.<<<<<<<<<<<
### NS. Compile The Component Before Uninstall Components