Updated 071 Reuse Custom Code (markdown)
parent
5bd528d719
commit
58601e42be
@ -23,7 +23,6 @@ Now we can start looking at the examples. That's really what I wanted to get to.
|
|||||||
|
|
||||||
[00:05:55](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m55s)
|
[00:05:55](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m55s)
|
||||||
|
|
||||||
The other way is the one that actually gets used in the helper class. I have one called getFilePath. The getFilePath is also a function I am using across my components. It is being included in JCB. Many of my components are using getFilePath and it is a little function I can pass a few parameters to and can consistently give me back a path of where I want to place or have files from. Now in the PHP helper there is a function and in the component itself, there is a function called [00:06:20](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m20s) helper classes - Both admin & site.
|
The other way is the one that actually gets used in the helper class. I have one called getFilePath. The getFilePath is also a function I am using across my components. It is being included in JCB. Many of my components are using getFilePath and it is a little function I can pass a few parameters to and can consistently give me back a path of where I want to place or have files from. Now in the PHP helper there is a function and in the component itself, there is a function called [00:06:20](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m20s) helper classes - Both admin & site. Anything that you put in will not be only added to the admin helper class, but also to the site helper class, a way to avoid doing it twice. As you can see there is one to put it in the admin. You could click yes and target the admin helper. Or you could target the site class helper. In this case most of this code I want it to be everywhere. [00:06:52](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m52s) If we were to go down to the bottom is the getFilePath. It is forming part of a whole bunch of code that I'm adding to the helper class of this component. I'm also using other components. I don't need to redo this code anytime soon. I don't need to come and open the [00:07:20](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m20s) component when I want to change the code. I can change the code right there in the place that's in the custom area. If we close out and go back to the custom code, you can see that the function is being used in Component Builder and in the php_helper_both. It's where it's added. [00:07:45](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m45s) If you'll need to improve the code, you can always at the bottom see in which areas it is being used. So that is the option for multiple reuse of custom scripting. You could put it anywhere you like in JCB, either in the component helper class or in the component view, php areas. By doing so it gets reused. It gets placed into that code on compilation. That's the answer I suppose, to the power of the customer code area.
|
||||||
|
|
||||||
????
|
I realize it could be confusing because we are mixing it with the IDE custom code which are [00:08:28](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m28s) this Hash (automation). It's where you edit your code in the IDE like I did here. The JCB is keeping track of it and it's saying this is for the admin views template default body php file. On this starting Hash value, we are doing an insert of this code and you cannot maintain the code here. But it's only for one file, one location, one place. [00:08:57](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m57s) Then there's the JCB manual and the JCB manual is the implementation or the mutated implementation of using custom code snippets, this snippet, all across in custom code areas. I'm using the same word custom code for different implementation. That might have been a mistake because you could miss its possible differences. [00:09:25](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m25s) But there is most certainly a difference, this doesn't target a file but an area somewhere in that JCB compilation. I hope that helps. Let me know.
|
||||||
So anything you put in here will be not only added to the admin helper class but also to the site Helper class sort of a way to Avoid doing it twice And As you can see There is one to just put it in the admin So you could just take care and just target the admin helper Or you could just target the site class helper But in this case most of this code I wanted to be everywhere [00:06:52](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m52s) And if we were to Go down to the very bottom suppose here Is the Get file Path So it is forming part of a whole bunch of code that I'm adding to the helper class of this component And which I'm also using another components so I don't need to redo this code anytime soon unless in in sorry I don't need to come and open the [00:07:20](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m20s) Component when I want to change this code I can just change the code Right there In the Place that it's in the custom area So that means if we close out here And we go back to the custom code You can see that the function is being used in component builder and in what field there PHP helper both It's where it's added And [00:07:45](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m45s) If you'll need improving the code you can always at the bottom see in which areas is being used So that is the option for multiple reuse of custom scripting So you could put it anywhere you like in JCB either in the component helper class or in the component View You know PHP areas And by doing so it gets reused it gets placed into that code on compilation And that's really the answer I suppose To the power of the customer code area I realize it could be confusing because we are mixing it with the IDE custom code which These are [00:08:28](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m28s) This hash Automation Is basically where you Edited your code in the IDE like I did here And the JCB is keeping track of it And it's saying ok this is for the admin views template default body php file And on the on this starting hash Value We are doing an insert of this code and you cannot maintain the code here But it's only for one file one location one place [00:08:57](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m57s) Then there's the JCB manual and the JCB manual Is the implementation or the mutated implementation Of using custom code snippets this snippet All across in custom code areas So that means I'm using the same word custom code For different implementation And That might have been a mistake because You could miss it's possible differences [00:09:25](https://www.youtube.com/watch?v=8Yl4lAAAWMQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m25s) But there is most certainly a difference this doesn't target a file but a actual area Somewhere in that JCB compilation So Yeah I hope that helps Let me know.
|
|
||||||
|
Loading…
Reference in New Issue
Block a user