Updated 056 How to use the file field type to upload a file in JCB (markdown)
parent
d754faa875
commit
35e3b9088f
@ -199,7 +199,7 @@ Now we have to add the Script that needs to be added to the save method. Here is
|
||||
|
||||
JavaScript will be used to do this. We have 'Add JavaScript' to 'view file' or 'Add JavaScript' to the 'view footer'. So it may be decided where to add the Javascript. Do we want to add JavaScript in a file that gets included in the header of the document or does we want to add it to the bottom of the view as a snippet? That is what we want to do because we want to use PHP. We are going to do some PHP in Add JavaScript(view-footer) area. [00:50:50](https://www.youtube.com/watch?v=o482sK4DxkM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h50m50s) Whereas in this Add JavaScript(view-file) area we cannot do PHP. So to show you exactly where this is going to come out, we are going to add a comment: `add javaScript here`, and I'm going to show you how we are going to do `<?php//also workes?>` [00:51:20](https://www.youtube.com/watch?v=o482sK4DxkM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h51m20s) Save that. Go out and compile this component and install it and then go look at its code. In our save class, we have '`upload the image`' and it is right. [00:51:56](https://www.youtube.com/watch?v=o482sK4DxkM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h51m56s) Search for our function. There is our function, in the same class that has been added through the JCB interface. It was not lost.
|
||||
|
||||
It's not exactly the same place we originally placed it, but it is in the same class and it is what we wanted. We wanted those classes to be available to us. Now look at the view and see where is that JavaScript going to be added. Close images, then go to `com_demo`, `view` and `look`, and `edit.php`.[00:52:31](https://www.youtube.com/watch?v=o482sK4DxkM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h52m31s) We are looking at that specific view, and here is the javaScript. It has been added to our `script` area and I am able to do php echo in the script area, which is what we are going to do. [00:53:14](https://www.youtube.com/watch?v=o482sK4DxkM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h53m14s) We are going to check whether that Banner Value is available to us on this page and use it to render the image in its appropriate place. <<<<
|
||||
It's not exactly the same place we originally placed it, but it is in the same class and it is what we wanted. We wanted those classes to be available to us. Now look at the view and see where is that JavaScript going to be added. Close images, then go to `com_demo`, `view` and `look`, and `edit.php`.[00:52:31](https://www.youtube.com/watch?v=o482sK4DxkM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h52m31s) We are looking at that specific view, and here is the javaScript. It has been added to our `script` area and I am able to do php echo in the script area, which is what we are going to do. [00:53:14](https://www.youtube.com/watch?v=o482sK4DxkM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h53m14s) We are going to check whether that Banner Value is available to us on this page and use it to render the image in its appropriate place.
|
||||
|
||||
### To Know Where The Values Are?
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user