Updated 013 dynamicGet (markdown)

Amigo 2019-07-16 13:40:51 +02:00
parent 6ca9a39200
commit 48380b6741

@ -4,11 +4,11 @@
[00:00:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m00s)
We are still working with Sermon Distributor; we are going to use Preacher, a 'get' I've already set up as an illustration. Here we have 'Back-end view' selected. (See video.) [00:00:25](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m25s) For example: Select nothing. This is how it will usually look when you start. Select this, (depending on which area of the back end you want to get the data from) and select back end view. That is the best way to do it. [00:00:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m39s)
We are still working with Sermon Distributor; we are going to use Preacher, a 'get' I've already set up as an illustration. Here we have 'Back-end view' selected. (See video.) [00:00:25](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m25s) For example: Select nothing. This is how it will usually look when you start. Select this, (depending on which area of the back end you want to get the data from) and select back end view. That is the best way to do it.
### Dynamic Get Source Selection
[00:00:50](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m50s)
[00:00:50](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m50s)
The Joomla database option 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 installed on your database at the stage. This means that you can reach out to other components through this dynamic get. [00:01:21](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m21s)
@ -27,7 +27,7 @@ These are the fields inside the 'Preacher' view. Load it and place this as 'asse
[00:04:23](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m23s)
There are four getTypes: 'getitem' which will get one item from the 'preacher' table and '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, select either 'getitem' or 'getlist'.) Then 'getcustom' and 'getcustoms', plural. The difference between these four is that you will only use the 'getitem' once per view. [00:05:04](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m04s)
If you are building a custom admin view, you will select a main 'get', either of a 'getitem' or either of a 'getlist'. You can add multiple 'getcustom' item or 'getcustoms' items. This can be seen as other methods that can be added 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:'getitem' and 'getlistquery', the exact naming of the methods that will be used. Then you have this 'getcustom' and 'getcustoms', which is almost the same as those two, except that they aren't 'main'. There will be another method in the model bringing data to the view. [00:06:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m00s) You can add as many 'getcustom' and 'getcustoms' methods to your view as you like, but you can only add one 'getitem' and one 'getlistquery'. To determine this is to ask what the main objective of the view is. What is the main dataset that needs to be used in the view? That is what the 'getlistquery' and 'getitem' respectively are going to be used for. [00:06:27](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m27s)
If you are building a custom admin view, you will select a main 'get', either of a 'getitem' or either of a 'getlist'. You can add multiple 'getcustom' item or 'getcustoms' items. This can be seen as other methods that can be added 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:'getitem' and 'getlistquery', the exact naming of the methods that will be used. Then you have this 'getcustom' and 'getcustoms', which is almost the same as those two, except that they aren't 'main'. There will be another method in the model bringing data to the view. [00:06:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m00s) You can add as many 'getcustom' and 'getcustoms' methods to your view as you like, but you can only add one 'getitem' and one 'getlistquery'. To determine this is to ask what the main objective of the view is. What is the main dataset that needs to be used in the view? That is what the 'getlistquery' and 'getitem' respectively are going to be used for.
### Get List Pagination
@ -53,7 +53,7 @@ The same alphabetic number may not be used twice in the whole query. The whole g
Decide what type of return this 'Return Row Type' have to be. If it is set to multiple, these names will automatically update. [00:12:02](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m02s) The get method will create a new method getting this data and adding it into your item list via this relationship. I'm adding the 'On Field' as the '.a' series; that is where the 'id' is for the series. [00:12:24](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m24s) In the joint field, 'c.id' is used. In the main database, that is the 'a' database. There must be a field called series. It has the id of the series. It corresponds to the id in this list. If it is necessary to return a multiple, the main database, in this case 'Sermon', can be linked to multiple series's. [00:12:56](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m56s)
In this system a sermon can only be connected to one series; it is a single return. It will immediately add this 'series_' in front of everything to insure it doesn't clash with your 'a' table. [00:13:18](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m18s)
The unwanted fields can be removed but the string should not be edited as it may malfunction. Further development still needs to be done in this area, making it possible to change the name to anything you like. At the moment you can change it but it will still write it this way in the code, dropping the fields you don't select. [00:13:54](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m54s) If you say that you don't want these, it won't get those fields and only this data will be returned. Again, you can have equal, not equal, equal or not. We also have 'IN' function. [00:14:22](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m22s) If this 'On field' is an array, you can use the 'IN' function to make sure that it checks whether the ID is in the array. [00:14:45](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m45s)
The unwanted fields can be removed but the string should not be edited as it may malfunction. Further development still needs to be done in this area, making it possible to change the name to anything you like. At the moment you can change it but it will still write it this way in the code, dropping the fields you don't select. [00:13:54](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m54s) If you say that you don't want these, it won't get those fields and only this data will be returned. Again, you can have equal, not equal, equal or not. We also have 'IN' function. [00:14:22](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m22s) If this 'On field' is an array, you can use the 'IN' function to make sure that it checks whether the ID is in the array.
### Dynamic Get Preacher In Code
@ -71,7 +71,7 @@ When we look at the site layout area and the templates I'll talk about this tran
[00:21:48](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m48s)
Returning to the dynamic get. A custom script area can be seen. If you click on it, there are different switches. You can select 'getlistquery', 'before getting the items', or 'after getting the items'. If you select 'after getting the items' and place code there, data gets dumped right after the initial items you received. [00:22:14](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m14s) It will add the code in there and return the items. That is why you can model the data in the dynamic get; write the code for the data after it had been 'get'. If this code had been removed, it will indicate if there is an array of items where all values are. [00:23:02](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m02s) Make sure those items are set and there. (A 'string bracket component helper function' is used to check whether the string is there.) Some nice PHP can be dumped here. Even before getting the item you can add some filters or get list query if this is model list. If it is item, there's a different set of switches is available. It adjusts to the type of query up here. [00:23:19](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m19s)
Returning to the dynamic get. A custom script area can be seen. If you click on it, there are different switches. You can select 'getlistquery', 'before getting the items', or 'after getting the items'. If you select 'after getting the items' and place code there, data gets dumped right after the initial items you received. [00:22:14](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m14s) It will add the code in there and return the items. That is why you can model the data in the dynamic get; write the code for the data after it had been 'get'. If this code had been removed, it will indicate if there is an array of items where all values are. [00:23:02](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m02s) Make sure those items are set and there. (A 'string bracket component helper function' is used to check whether the string is there.) Some nice PHP can be dumped here. Even before getting the item you can add some filters or get list query if this is model list. If it is item, there's a different set of switches is available. It adjusts to the type of query up here.
### Dynamic Get Join DB Tables
@ -93,13 +93,13 @@ There is a list of possible filtering. Depending on what needs to be done any of
[00:27:38](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m38s)
We have a bunch of values that fire every time in a custom dynamic get model. You might need these values. (See video.) Instead of doing custom scripting to get these values on the page, these values gets dynamically added every time. The 'userid', the 'group', the 'authorised group', the 'access level', the 'app', and the 'input values' are on the page by either URL or post; it indicates that it has been initiated, and set it to true. [00:28:08](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m08s) If you have custom methods, like 'getpreacher', it checks whether it had been set. If it had, it does not set it again; it is ready to be used. But if it hasn't been set, it sets it, and again sets it to true. [00:28:32](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m32s) These global variables can be used inside the code like the global variable we spoke of earlier. Out of that global variable we access the 'levels', which has the get authorized view levels of the specific user that has now accessed this model or the view this model belongs to. If it is in the access levels. [00:29:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m00s) 'Public' is another access level. If the user isn't signed in, he is 'public'. This will validate true in the query. Set it up by adding access level in 'a.access'. [00:29:28](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m28s) Check in the main source table for 'a.access' if the user is there. So you don't need to add a 'state key' because the code is done for you. [00:23:44](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m44s)
We have a bunch of values that fire every time in a custom dynamic get model. You might need these values. (See video.) Instead of doing custom scripting to get these values on the page, these values gets dynamically added every time. The 'userid', the 'group', the 'authorised group', the 'access level', the 'app', and the 'input values' are on the page by either URL or post; it indicates that it has been initiated, and set it to true. [00:28:08](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m08s) If you have custom methods, like 'getpreacher', it checks whether it had been set. If it had, it does not set it again; it is ready to be used. But if it hasn't been set, it sets it, and again sets it to true. [00:28:32](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m32s) These global variables can be used inside the code like the global variable we spoke of earlier. Out of that global variable we access the 'levels', which has the get authorized view levels of the specific user that has now accessed this model or the view this model belongs to. If it is in the access levels. [00:29:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m00s) 'Public' is another access level. If the user isn't signed in, he is 'public'. This will validate true in the query. Set it up by adding access level in 'a.access'. [00:29:28](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m28s) Check in the main source table for 'a.access' if the user is there. So you don't need to add a 'state key' because the code is done for you.
### Dynamic Get "Where"
[00:29:48](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m48s)
You can add any table key equal to a certain value.The value could be another table like "b.field" or it even a global variable, like we said we can set up. It can also be an 'userid' which is already on the table. It could be done as in this case, only an integer, '1'. It is important to make sure that all the sermons returned are published. [00:30:18](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m18s) If you have an unpublished sermon it won't be returned at all.[00:27:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m39s)
You can add any table key equal to a certain value.The value could be another table like "b.field" or it even a global variable, like we said we can set up. It can also be an 'userid' which is already on the table. It could be done as in this case, only an integer, '1'. It is important to make sure that all the sermons returned are published. [00:30:18](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m18s) If you have an unpublished sermon it won't be returned at all.
### Dynamic Get Ordering