From cfb053ac331fb1ba694e0328afffea258e81150a Mon Sep 17 00:00:00 2001 From: Amigo <49749100+aamigo@users.noreply.github.com> Date: Wed, 26 Jun 2019 14:01:50 +0200 Subject: [PATCH] Updated 040 Adding Helper Structures to any JCB component (markdown) --- ...-Helper-Structures-to-any-JCB-component.md | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/040-Adding-Helper-Structures-to-any-JCB-component.md b/040-Adding-Helper-Structures-to-any-JCB-component.md index b5c3591..19e40ed 100644 --- a/040-Adding-Helper-Structures-to-any-JCB-component.md +++ b/040-Adding-Helper-Structures-to-any-JCB-component.md @@ -28,8 +28,25 @@ This is usually what we will use when we ship a component. Since this will then You could say text for [00:07:20](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m20s) example, and you could say "This is the help you need" and whatever. Save and close. If we go to Looks, we'll see automatically there is a new button called Help. If we click on it, it opens that Help. [00:07:47](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m47s) You can go back to if you click on New then that Help menu won't show anymore. But you can close out, and you can then go back to the Help Documents, create another one. Again select or you could target a specific group, or you can target all groups. Again Admin area you can also target the Site area, and be able to link it to any of the front end areas. We can say now we don't want to [00:08:32](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m32s) target the list(Looks), but the edit area(Look) which is singular. Again we can say give it a title. This time let me link it to an URL. Save and close. Let's go to Looks area, add New, and now we see that area also has a Help button. If we click on it, it opens that URL [00:09:13](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m13s) in a pop-up, and as you see I just selected a video. That is how you can link to other external sources to be giving the Help to the specific page in the instructions that is necessary. +### System Name +* Remember to Compile Before Install -Having set up a few Help Menus for the Component you can go back to Component Builder and to the Admin View [00:09:46](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m46s) Area, and let's say you have a Help Document linked to Component Demo, you want to ship it with the information that you've created as Help inside of the Component, then what I would do is, I would open this Admin View, and I'll give it a system name of Help Document (demo). +Having set up a few Help Menus for the Component you can go back to Component Builder and to the Admin View [00:09:46](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m46s) Area, and let's say you have a Help Document linked to Component Demo, you want to ship it with the information that you've created as Help inside of the Component. What I would do is, I would open this Admin View, and I'll give it a system name of demo. I'll go to MySQL(add MySQL), [00:10:31](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m31s) say yes, I wanted to link it. 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. -???? -I'll go to MySQL, [00:10:31](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m31s) say yes, I wanted to link it, I'll select Table, I would go to the Demo table Help document you see demo help document click on that And I'll just remove some of the Values that I know Is not necessary Ok I think that's fine Created modified can stay I wouldn't even take the version out but [00:11:05](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m05s) Doesn't even matter We can most certainly take that one out And there we go those seems to be fine And save and close Now I can save this Or save as copy And if I have another component I'll just copy this one And link it to that components data base 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 you must first compile the component before you uninstall the local component So you would first come here and compile that component Now let me quickly show you in the code what is happened Basically I've Opened this zipped package of a component gone to admin area then to sql And then if I go to the install MySQL Document I'm just double clicked on that And it's open this document I'll now see that they obviously has this [00:12:25](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m25s) Insert table But it also has Insert Data That we created see there is This is the help You need there's a URL I added And it will basically 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) So Having done those changes and linking the table to the component It actually goes to the database in the extract these values and places it Into the dump file of the Component It does not place it into the update file just that you know and 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 why you can insert this data into the Database Ok now I'm gonna show you what happens if the component is no longer installed And you try to compile it The first thing is I'm gonna quickly uninstalled the demo component Now I'm gonna go to the compiler And I'm gonna try and compile this component It will give me this error And basically it's telling you that it couldn't find This table [00:14:24](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m24s) It couldn't find that table and it's because you uninstalled it And the only way then to compile this component Would be to go back to the admin view And deLink the component from the table So like I said make sure to compile the component Before you uninstall The component which you are linking to So we linked To the installed components table The other way to try and avoid this [00:14:55](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m55s) Is to actually instead of linking to the table Like we did here is to instead use a dump file So I would say you click on dump You open your sql File that it created And you copy The the values from that file or cut whatever And paste as values in here Like that [00:15:28](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m28s) You could leave the comment or even leave a comment out And this way if we save and close We will now Even if the component is uninstalled be able to compile And still have this demo Or Shipping values Of the component in place So let's try compiling it again This time it compiled without any errors [00:16:04](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m04s) And if we go open the ZIP package And then open this install MySQL .utf8.sql file We will see that it added that dump Values right back into the file and that's exactly what you would like it to do Anyway This was just to demonstrate actually How to add A help menu structure To any JCB component [00:16:45](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m45s) Basically you could do that without purchasing the Sermon distributor component The only part that really is necessary Is for you to create a helper document And of course This helper document That we are using from the Sermon distributor package has custom scripting in it And it's this custom scripting that makes it a adaptable to any other component I can Quickly Show you which areas this custom scripting must go [00:17:18](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m18s) But obviously I would rather wanted to buy the components package It's really only in a relation To the articles And to the site views And the admin View That we have custom Fields That are a little tricky As well as the user group You need to [00:17:42](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m42s) Have a little perspective on how to setup user groups So these are the two areas that are difficult the articles one as well Because JCB when it has When it detects that this is a help helper document and it detects those specific field Values that are set up correctly then it automatically Build some of the front-end necessary concepts as well as adding This dynamic behaviour in the backend I hope this helps to To at least show you that it is very doable the adding and help [00:18:25](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m25s) Structure to a component What I think makes this quite unique Is that The component then ships with this Pre built in help structure but the user that uses your component He might want to give extra help or little different kind of help to the front end users of his Website And he will be having access to this helper area and editing it and changing it to To the correct wording and expectations that he might have Or she [00:18:59](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m59s) Might have And so that is the way that you could add helper structures To your JCB components Thank you for watching +### 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. + +### 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. + +### NS. Compile The Component Before Uninstall Components + +Like I said make sure to compile the component before you uninstall the component which you are linking to. We linked to the installed components table. The other way to try and avoid this [00:14:55](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m55s) is to instead of linking to the table, is to use a Dump file. I would click on Dump. Open your sql file that it created, and copy the values from that file or cut whatever. Paste those values in here MySQL. [00:15:28](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m28s) You could leave a comment or even leave a comment out. This way if we save and close, we will even if the component is uninstalled, be able to compile. And still have this Demo or Shipping values of the component in place. Let's try compiling it again. This time it compiled without any errors. [00:16:04](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m04s) If we go open the com_demo_v2_0_0_J3.zip package, Admin, sql, and then open install.mysql.utf8.sql file. We will see that it added that Dump Values right back into the file, and that's exactly what you would like it to do. This was just to demonstrate how to add a Help Menu Structure to any JCB Component. [00:16:45](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m45s) + +You could do that without purchasing the Sermon Distributor Component. The only part that really is necessary, is for you to create a Helper Document, and of course this Helper Document that we are using from the Sermon Distributor Package has custom scripting in it. And it's this custom scripting that makes it adaptable to any other Component. I can quickly show you which areas this custom scripting must go, [00:17:18](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m18s) but I would rather want you to buy the Components Package. It's in a relation to the Articles, and to the Site Views, and the Admin View, that we have Custom Fields that are a little tricky, as well as the user group. You need to [00:17:42](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m42s) have a little perspective on how to setup user groups. + +### JCB Detects If It Is A Help Document + +Admin View and Site View are the two areas that are difficult as well as the Articles. When JCB detects that this is a Help Document, and it detects those specific field values that are set up correctly, then it automatically build some of the front-end necessary concepts as well as adding this dynamic behavior in the back end. I hope this helps to at least show you that it is very doable, the adding in help [00:18:25](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m25s) structure to a component. What I think makes this quite unique is that the component then ships with this pre-built in Help Structure, but the user that uses your component, he might want to give extra help or little different kind of help to the front end users of his Website, and he will be having access to this Help Area and editing it and changing it to the correct wording and expectations that he might have. [00:18:59](https://www.youtube.com/watch?v=nw9YPu9emws&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m59s) That is the way that you could add Helper structures to your JCB components. \ No newline at end of file