Updated 013 dynamicGet (markdown)

Amigo 2019-06-12 12:38:33 +02:00
parent 96905d2ac7
commit e3cb421b31
1 changed files with 10 additions and 5 deletions

@ -2,21 +2,26 @@
### Sermon - Preacher Get Example
Hi we still working with sermon distributor. I'm going to use this preacher, which is a get that I already have set up here. I'll use that in our illustration. Here we can see that I have this back end [00:00:25](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m25s) view selected. So let me select nothing. This is usually how it will look when you start. You'd look select this, (depending on which [00:00:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m39s) area of the back end you want to get the data from) you'd select back end view. Which is the best way to do it.
We are still working with Sermon Distributor and is going to use Preacher, which is a 'get' that I already have set up as illustration. Here we have 'Back-end view' selected.[00:00:25](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m25s) For example: Let me select nothing. This is usually how it will look when you start. You would select this, (depending on which [00:00:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m39s) area of the back end you want to get the data from) you would select back end view. Which is the best way to do it.
### Dynamic Get Source Selection
Then there is the Joomla database option. Would gives you the access to draw data from any other component installed that moment in the Joomla Website. [00:01:01](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m01s) If you select your Joomla database, you can select any database that is actually at that stage on your database installed. That means you can reach out to other components through this dynamic get. I'm not going to do that. [00:01:21](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m21s) In fact that's also an area which I haven't tested so well. You possibly might try to implement that and ran into some bugs. This stage I can't make any apologies for that since the thing you should do is, instead using back end view option. [00:01:42](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m42s) You might say but why is the other option there? Well it's because that's a feature we certainly want in the application. I'm busy working in that direction, busy programming so did that feature will work without any problems. In fact for the most part if you don't do very complex mapping, if you just do a simple direct database fetch like that(cb_associations), you will be able to use this, it won't give you an issue. [00:02:09](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m09s) What it really is about, is these other linked or joint database structures. That would make it complex. That might cause problems. I'm not 100% sure. Obviously it did work. I haven't tested it well enough as well as I have tested the other part and that is this back-end view. [00:02:32](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m32s)
Then there is the Joomla database option which gives you the access to draw data from any other component installed that moment in the Joomla Website. [00:01:01](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m01s) If you select your Joomla database, you can select any database that is actually at that stage on your database installed. Which means that you can reach out to other components through this dynamic get. I'm not going to do that. [00:01:21](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m21s) In fact that's also an area which I haven't tested so well. You possibly might try to implement that and ran into some trouble. At this stage it is better instead, to use the 'Back-end view' option. [00:01:42](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m42s) The reason that the other option is there is because we certainly want that feature in the application while work is meanwhile been done to improve it. For most part, if not very complex mapping is done, like if you do a simple direct database fetch like 'cb_associations', you will be able to use this, there will not be any complications. [00:02:09](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m09s) What make it complex is these other linked or joint database structures. I haven't tested it yet as I have done with this back-end view. [00:02:32](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m32s)
There is also the custom option. Where you can just dump the whole option of using component builder to write your PHP for you. Here(custom Get) you can add custom PHP, it will add the methods data for you. This is a custom get option where you write the code [00:02:55](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m55s) by hand. Where as this(Custom - dropdown) option writes the code for you. You'd select the back end view that you want to use. That back end view will be the view that you connected to your component. You need to type your name in here, and then select that package, and it will load [00:03:20](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m20s) all the field names, like a.id, and a.asset, id, and a.name, and allias, and icon.
There is also the 'Custom' option to use Component Builder to write your PHP for you. At'custom Get' you can add custom PHP, that will add the methods data for you. This is a 'custom get' option where you write the code [00:02:55](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m55s) by hand. Where as this'Custom - dropdown' option writes the code for you. You need to select the Back-end view that you want to use. That Back-end view will be the view that you connect to your component. You need to type your name in here, and then select that package, and it will load [00:03:20](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m20s) all the field names, like 'a.id', 'a.asset', 'id', 'a.name', 'allias', and 'icon'.
### Dynamic Get Preacher View
These are all the fields inside of this(Preacher) view. I will load it and I'll put this as asset_id. I would suggest you don't change that. What you can do is you can take out a row. [00:03:50](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m50s) You can remove a row like that, and you can say I don't need that row. I don't need these. Way to there, that's all the data you might want. And then you will know that this would be the variable name of the data on when these get is used. [00:04:13](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m13s) That is the basic part of setting up a Get.
These are all the fields inside of this'Preacher' view. I will load it and I'll put this as 'asset_id'.(See video) It is suggested that you don't change that. You can take out a row. [00:03:50](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m50s) You can remove a row if it is not needed. What remains is all the data you might want. You will know that this would be the variable name of the data when this get is used. [00:04:13](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m13s) That is the basic part of setting up a Get.
### Get Types - Get Item/List Get Custom
I need to mention that you have getTypes as well. The getTypes have 4 of them. The getitem which will get one item from this preacher table. Then you got the getlistquery which will get multiple items. [00:04:41](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m41s) Depending on how many items you want to get from the database, you would select either get item or get list. Then you get getcustom, and then you got getcustoms, that plural. The difference between these two or four is the getitem is what you will use only once per [00:05:04](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m04s) view.
There are four getTypes . The 'getitem' which will get one item from this 'preacher' table then there is 'getlistquery' which will get multiple items. [00:04:41](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m41s) Depending on how many items you want to get from the database, you would select either 'getitem' or 'getlist'. Then you get 'getcustom', and then there is 'getcustoms', plural. The difference between these four is that the 'getitem' is what you will use only once per [00:05:04](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m04s) view. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
If you are building a custom admin view, you will select a main get either, or a getitem or a getlist. You can add multiple getcustom item or getcustoms item. You can see these as other methods that you're adding to the page, but it's not the main method. [00:05:30](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m30s) You have main methods which are these getitem and getlistquery. Which by the way is the exact naming of the methods that will be used. Then you have this getcustom and getcustoms, which is almost same as these two, it's just that they are not main. There will only be another method in the model which will bring data to the view. You can add as many getcustom and getcustoms [00:06:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m00s) methods to your view as you like, but you could only add one getitem, and one getlistquery. Usually the way we would decide on this is that we would say what is the main objective of the view? What is the main dataset that we want to use in the view? That is what we will use in the getlistquery and getitem.[00:06:27](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m27s)