Skip to content

012 Component FTP and more

Amigo edited this page Jun 12, 2019 · 21 revisions

COMPONENT FTP AND MORE

Adding README Script

Next we are going to add the README script to a component in the component view. The README script is commonly used as the components homepage. For example: If you go to the demo components page on Github, you'd see that it has this image, some details, and some layout. (See video.) This all is done with the README file. We can open it and look at the 'Raw'. It is the same text that we looked at previously. 00:00:53 Inside component builder you can add this README and README text. These are placeholders. (###version###).

Place Holders

Now (#) is part of the markdown for a header. You need to be acquainted with Markdown to know what is placeholders and what isn't. This script has been added in order for you to get an idea of placeholders. 00:01:27 These placeholders are automatically updated from the details that are in these fields. The actual placeholder names can be seen. If you change the version here it will update there automatically. (See video.)

Component-Builder Link Back Info

This is a place to give information to those who are using your application. 00:02:01 You can add links to it, add links to help menus, instructions on installing it, or anything else that you like to share through the README file. Although it is not compulsory , it will be appreciated if this commenting area can be left as it is in order for more people to get involved in the community. Help us to sustain this project. 00:02:36

Markdown Info

If you want to know more about markdown, you can open this link: https://www.markdownguide.org/cheat-sheet/

Admin - Site Views Adding Editing

This admin view area and the site view area is a place where you can create new admin views.00:03:06 Realize that if you create a new admin view it's not necessarily linked to this component. You still need to link it in settings under admin view. This is a place to create admin views or edit existing admin views that are linked to this component. The same applies to site views. It's an easy way to gain access to editing the site views that are already linked to this application. 00:03:51

FTP Info - Updating Component

The FTP server had been added to make it possible to move this component to your server and to add the feature of automated updating that is in Joomla. The update server is a Joomla concept. For example: If a component like 'Sermon Distributor' is opened and we look at the XML file of this component in the back end, you'd see that Component Builder had build the whole file. 00:04:39 But at the very bottom you'd see an updates server. It is being added only if you set it. If this is set to 'no', it won't add an update server. 00:05:03 If you add 'yes,' you can set the link to where the update server is going to be hosted. It will automatically take that link and add it into your XML file. Component Builder can also build that file for you. This is what is whould look like. (See video.) 00:05:31 This FTP Binary is usually 21; the default value FTP binary would be 15; and a username and a password. 00:06:04 These FTP details should login directly to this folder that you have up here. (See video.) Component Builder logs into your server, move this file in there, then disconnects. (See video.) This information will make it possible for him to perform that.

FTP Info - Sales Server

The same applies to the sales server which usually would be very much the same concept. You will simply be adding the same kind of string . Except usually the update server and the sales server is not the same place. 00:06:47 The update server, let the user know, that there is an update. Whereas the sales server, let the user know where this component zip file will be stored on the server. In the case of something like WHMCS or another component through which you are selling your extensions, you can use the folder in your server which is looking for the files. You can use that folder, you can create a FTP account in that folder, and then set that details in this field (See video). If 'compile' is clicked, Component Builder shows aan option, 'add backup folder' and 'save sales server' and then click 'yes'. If you compile it now, it will move the 'zip file' to 'sales server', as well as creating a backup. 00:07:30

Component Builder Global Options

The 'backup' and the 'Git' folder is set up in your Components Global options. If you open 'Global Options', you will see this area, which shows that this field is encrypted. If you go to global settings in Component Builder it shows the encryption settings. 00:08:18 Once you have added your own key it will encrypt. You must not change it because it will not be able to decrypt, as it is used to encrypt and as well to decrypt the data. Consequently everything that has been encrypted then needs to be redone. In this case it is going to be these login FTP login information. This is the basic encryption which have been mentioned when we talked about storing types. There is basic encryption and advanced encryption. We are dealing here with the basic encryption way which is also called 'basic key.' 00:09:01

Component Builder Folder Paths

These two first folder paths, called 'compiler folder' and 'custom folder', leave them for now, they are not flexible. To move them at this stage is difficult, just leave them blank. Here at 'Backup Folder Path' you should add a backup folder. This should be related to the root of your server, as well as to a 'Git' folder. 00:09:41 The 'Git' folder would be where component builder creates a folder with all the components files without zipping them. You can go to that folder and create a 'Git create'and a 'Git repository'. From that folder you can push it to Github or any other Git server respectively. It's able to create a folder from which you can do Github or any other kind of repository work which are separate from your backup folder and also separate from the temporary folder in which it compiles the component.00:10:17 You can move it out of your Joomla install. That is the function of the folder paths, it does the Git Repository when you compile the component and it will not delete the .Gitfolder, it will just replace all the files in it.

First remove the old ones, then add the new ones and Git will see that only the files that has been changed, will be noticed, and the ones that you need to recommit and do just a normal commit to get it into your repository. If you don't know Git, then possibly it doesn't make sense to you. There is courses about Git on Lynda.com: https://www.google.com/search?q=lynda.com+courses&oq=lynda.&aqs=chrome.2.69i60j69i57j0l2j69i60j0.7499j0j7&sourceid=chrome&ie=UTF-8 as well as Udome. That's a backup folder and the sales server. 00:11:18 The same applies here with this FTP credentials should be that direct folder in which these zip files should be stored. Unfortunately component builder cannot store it in subfolders at this point. The FTP details will login to that FTP account,and in that very folder which has the access you'll put the file. No sub-folders or other folders, the FTP details should be going directly to the folder. In the Component Builder, in the back end, 'components', 'component builder' and then 'Helpers'. There is a file called 'compiler'. 00:12:14 If you open that file, you would see that we have a function 'buildme'. Here's all the placeholders that you can use in the 'buildme' file, and it will be replaced with the relative information.

Component Builder Compiler.PHP FTP Info

There is a function called move file to FTP server. This move file to FTP server, calls another function called: 'getFTP'. Now 'getFTP' is this function here(See video) and it takes the signature, checks whether we already made such a connection before and then loads that object. But here I'm using this parse string function to convert the string into the variables. All the variables in that string is converted to arrays or variables respectively. 00:13:12 That then is used to make use of Joomlas own client FTP class. If you want to know where that is, you can click in NetBeans 'control spacebar'. It shows that it is in libraries/Joomla/client/FTP.PHP. You can click there, open it, so we will be using Joomlas built-in FTP client, and passing the host, the port, the option, the username, the password, and making a connection. Then we sends that off to do this move file, which then takes the file content and moves it to the server. That's just for your own piece of mind that the data itself is not being leaked or compromised. 00:14:04 It's all handled right here and you can follow its events in Component Builder, from 'relations' to the update server as well as to the sales server.

Update Server Extra Info(Versions)

Quite important is this update server, it is an XML file. 00:14:25 This XML file is build up of versions and download links to those versions. As explained in a previous video, there is this reality that while you are developing your component, your users wouldn't need any change of updates or anything.00:14:47 The moment you put your component out there on the web, immediately you need to consider when you make a change in the application, and how will you user be able adapt to that change. The biggest changes you can make 00:15:03 is adding new views or adding new fields to the component. Like I have explained previously: With the History component we've done scripting to deal with that problem. 00:15:21 You also need to consider the database. We have created this thing called: Version Updates. Which gives you the ability to add SQL scripting, which needs to be executed upon the updating.

  • Table Alteration 1.2.9 version If you have the new version 1.2.9, there needs to be a table alteration. 00:15:43 You need to know if MySQL commands to do that. You need to put that MySQL command in (MySQL - Update Dump) according to the Joomla conventions. The table name must have that '#_ _' in front of it and Joomla will dynamically put in the prefix. You might do a MySQL script here. If you are making a change and the new release is 1.2.9 and 1.0 didn't have that 00:16:23 specific field or view, then you must realize that you're updating this one and the SQL must come next to that specific version. The update must be placed at the version, which needs the update. If you make a change don't put it here(1.2.9), because it won't update correctly. You need to put the update next 00:16:44 to the version(1.0) that needs to be updated. Then over here(Version URL), you would put the link to the respective downloads. Like here we have version 1.2.9 and then we have version 1.3.0 00:16:59and we added the 1.3.0 link.(see video)

I'm using GitHub as my distributing platform of the application. You could use any URL. These URLs is what will be used in your updates server. In the update server, 00:17:18 we will go to the update server link, copy that. You'd see that it has URLs, for the download. As we move on it 1.3.0, 1.3.1, 1.3.2. and it's getting these details. It is getting them 00:17:48 from this version update area. The last version in this list being 1.3.2, must be the same as the one that you set here.(See video) That is important. We are at the current version 00:18:07 and it will do the necessary adjustments to that.

That is all the concepts that would be necessary to cover regarding the component area. We've looked at adding admin views. 00:18:26 We will again look at site views and adding them as well as your custom admin views. We will possibly going into more depths about this MySQL tweak, what we briefly mentioned. But the for most part that is the component area, 00:18:48 and all it's features. It all stacks upon each other from the fields then the admin views, and then the components themselves. If you have come this far setting up your component, added some admin views, you are now ready to 00:19:06 start building the front and the site area. You wouldn't be able to do that effectively until now. It is necessary to first do the admin views and then only do the site views.

Clone this wiki locally