Updated 031 Automatic import of custom code during compilation in JCB (markdown)

Amigo 2019-07-12 12:34:49 +02:00
parent 3eeab9a24d
commit 71ad490490
1 changed files with 9 additions and 4 deletions

@ -25,19 +25,24 @@ There are some conventions and regulations that should be considered when the wa
There are a few limitations. Code can not be added closer to each other than about 6 lines. If there are going to be code closer to each other and it ends and starts within the parameter of 6 lines, you will end up with a problem, especially at the end. [00:06:14](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m14s) The reason is Component Builder doesn't only use the line in which this is found to remember where to place it, but actually creates a fingerprint of the code above this insertion and the code below this insertion, to accurately insert it in the future. If that code changes, Component Builder will give notice and will not insert the code. That is due to the nature of JCB. It is constantly being improved and therefore its code moves around quite a lot.[00:06:48](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m48s) It had been impossible to automate this, because code may accidentally be overwritten which has never been intended.
The only way to solve this was to create what is called a "fingerprint", a few lines above the insertion of the replacement and a few lines below the replacement. To insert new code this will be used(///&ast;&ast;&ast;[INSERT<>$$$$]&ast;&ast;&ast;///). To replace new code or if it is initially done, use that(///&ast;&ast;&ast;[REPLACE<>$$$$]&ast;&ast;&ast;///) [00:07:25](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m25s) At the end of the code add these corresponding placeholders(///&ast;&ast;&ast;[INSERT<>$$$$]&ast;&ast;&ast;///) and(///&ast;&ast;&ast;[REPLACE<>$$$$]&ast;&ast;&ast;///) . This little block(see video)is placed into the comments of this tutorial. If any of you need to copy it get it from here. When Component Builder adds it back, it will look like this(///&ast;&ast;&ast;[INSERT<>$$$$]&ast;&ast;&ast;///23) if it is inserted and like this(///&ast;&ast;&ast;[INSERT<>$$$$]&ast;&ast;&ast;///25) when it is replaced. Just add that diamond(<>) in there for it to be updated in the database. <<<<<<<<<<<<<<<<<<<<<
The only way to solve this was to create what is called a "fingerprint", a few lines above the insertion of the replacement and a few lines below the replacement. To insert new code this will be used(///&ast;&ast;&ast;[INSERT<>$$$$]&ast;&ast;&ast;///). To replace new code or if it is initially done, use that(///&ast;&ast;&ast;[REPLACE<>$$$$]&ast;&ast;&ast;///) [00:07:25](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m25s) At the end of the code add these corresponding placeholders(///&ast;&ast;&ast;[INSERT<>$$$$]&ast;&ast;&ast;///) and(///&ast;&ast;&ast;[REPLACE<>$$$$]&ast;&ast;&ast;///) . This little block(see video)is placed into the comments of this tutorial. If any of you need to copy it get it from here. When Component Builder adds it back, it will look like this(///&ast;&ast;&ast;[INSERT<>$$$$]&ast;&ast;&ast;///23) if it is inserted and like this(///&ast;&ast;&ast;[INSERT<>$$$$]&ast;&ast;&ast;///25) when it is replaced. Just add that diamond(<>) in there for it to be updated in the database.
* ### Showing Example With Replace(see video)[00:08:00](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m00s)
Let's see this in action. So here we have that demo components main document open. I'm going to add some replacement tags here. I'm not making any changes but I could add a few lines here - ///. Maybe another comment - 'hi it worked', [00:08:34](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m34s) let's do - echo 'hi it worked' and that should do it. This is going to replace this area.
Let's see this in action. Here is Demo Components main document open. Some replacement tags is added. No changes is made but a few lines is added here - ///. Maybe another comment - 'hi it worked', [00:08:34](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m34s) let's do - echo 'hi it worked' and that should do it. This is going to replace this area.
### Recompiling The Demo Component With Replace [00:08:58](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m58s)
Let's go to the compiler and compile the component. See what happens. So in the compiler I'm going to compile a component again. It successfully compiled. Now before I install it I could do a check to see whether it actually did get the code from the component.
Let's go to the compiler and compile the component. So in the compiler I'm going to compile a component again. It is successfully compiled. Now before it is installed a check may be done to see whether it actually did get the code from the component.
### Checking The Custom Code Tab Before Installing [00:09:24](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m24s)
The way I'll do that is I'm just going to open custom codes in a new tab. And low and behold there is says component demo and the path in which the change was made, and it was a replacement. We can open that and there is the code that we want replaced. And there is the hashtag for the start, the fingerprint and the hashtag for the end. The lines it's in a replacement and everything seems quite great. All we will need to do on this area is click install. Then that'll be the compiled version.
The way it's done is to open Custom Codes in a new tab. There the component demo and the path in which the change was made may be seen, and it was a replacement. If it is opened, the code that we want replaced can be seen and the hashtag for the start, the fingerprint and the hashtag for the end. All that need to be done on this area is to click 'Install'. That will be the compiled version. <<<<<<<<<<<<<<<<<<<<<<
### Looking at The Replaced Code In Editor [00:10:03](https://www.youtube.com/watch?v=DFMfIl-VkSk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m03s)