Updated 014 Adding dynamicGet to a Site View (markdown)

Amigo 2019-08-15 16:56:15 +02:00
parent 06cacc0969
commit 5833fd48fa
1 changed files with 6 additions and 6 deletions

@ -11,7 +11,7 @@ Now that we have the dynamicGet in place, let's add it to a site view and look a
[00:00:32](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m32s)
On the right-hand there are three fields you can populate with your dynamicget methods. The first is where you'd add all the custom dynamicgets. There you can add multiple custom dynamicgets. The second is where you add your main dynamicget as we explained in the dynamicget tutorial. You can add one main get method per site view since it will be buildt in the model, either as a getitem or getitems. [00:00:57](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m57s) It depends whether the main get it is a list or an individual item. Whatever the case, you may include as many custom dynamicgets as you like. You have this data available in your view. (See video.) These two first fields are used to load the dynamicget to the view.
On the right-hand, there are three fields you can populate with your dynamicget methods. The first is where you'd add all the custom dynamicgets. There you can add multiple custom dynamicgets. The second is where you add your main dynamicget as we explained in the dynamicget tutorial. You can add one main get method per site view since it will be built in the model, either as a getitem or getitems. [00:00:57](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m57s) It depends whether the main get it is a list or an individual item. Whatever the case, you may include as many custom dynamicgets as you like. You have this data available in your view. (See video.) These two first fields are used to load the dynamicget to the view.
### Dynamic Values
@ -24,7 +24,7 @@ each of these by clicking on it; right click and copy or ctrl C and command C to
[00:03:36](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m36s)
We use Dynamic Values code in the default view to display the data in a PHP way. You can get the customerget here. The value is going to be in this preacher. (Make sure you have a preacher.) This block deals with displaying the data related to the information. This one here checks whether the main items are on the page. (See video.) [00:04:08](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m08s) The main items are sermons, preacher.id, getlist, etc. If you go down to the sermon preacher, you'd get list; the values are in items. It's an array. You can loop through it and target the object values. That's what's being done here. First check whether the values are on the page. [00:04:38](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m38s) If we see that it is there, we make use of templates to display the various layouts. [00:05:01](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m01s)
We use Dynamic Values code in the default view to display the data in a PHP way. You can get the customerget here. The value is going to be in this preacher. (Make sure you have a preacher.) This block deals with displaying the data related to the information. This one here checks whether the main items are on the page. (See video.) [00:04:08](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m08s) The main items are sermons, preacher.id, getlist, etc. If you go down to the sermon preacher, you'd get list; the values are in items. It's an array. You can loop through it and target the object values. That's what's being done here. First, check whether the values are on the page. [00:04:38](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m38s) If we see that it is there, we make use of templates to display the various layouts. [00:05:01](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m01s)
### Making Use of Data Being Passed Through to the View
@ -36,7 +36,7 @@ This data structure is the data structure you can expect from each one of these
[00:06:13](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m13s)
This is proposing the dataset structure: ideally you'd this value here, and do this in the code. (See video.) Do a var_dump, exit, do a build, and look at the view to see the structure. [00:06:45](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m45s) If you are finding that this structure isn't working as we expected, this might help map the array and see where which value is found. The same goes with any of the others. Grab that area that you want to peek into, place it in var_dump, do a build, and look at the page in the front of your site. You can see the structure of the object here, whether it's an array, an array with objects, or whatever is placed inside this value set through the dynamic get method. (See video.) [00:07:20](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m20s)
This is proposing the dataset structure: Ideally, you had this value here, and do this in the code. (See video.) Do a var_dump, exit, do a build, and look at the view to see the structure. [00:06:45](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m45s) If you are finding that this structure isn't working as we expected, this might help map the array and see where which value is found. The same goes for any of the others. Grab that area that you want to peek into, place it in var_dump, do a build, and look at the page in the front of your site. You can see the structure of the object here, whether it's an array, an array with objects, or whatever is placed inside this value set through the dynamic get method. (See video.) [00:07:20](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m20s)
### Gets In The Code eg: Preacher.php
@ -48,19 +48,19 @@ Let's look at how Custom Gets methods are becoming available in your view by goi
[00:09:06](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m06s)
I've opened that dynamic get here. Sermon is set as 'a,' the main table. If you open Join View Table - Add, series is set as 'c' looking for selection values. Preacher is set as 'd', only selection values. Statistics 'e' is a list. It is multiple. [00:09:36](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m36s) These (preacher, series) single ones are part of the listquery whereas the multiple of it would have its own method. In the Join DB table add category as single and 'b' those values. [00:10:01](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m01s) Going back to the code, this is the getListquery in the getitem. After we received the items we look through them in getSermonstatistics and a generated string to ensure no conflicting with other methods on the page. Place the values in 'id sermonsstatisticsE'. [00:10:30](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m30s) This is where the values are placed. (See video.) We have a custom method here. Like we had shown in the dynamic get you can add custom methods and return the items to the page.
I've opened that dynamic get here. Sermon is set as 'a,' the main table. If you open Join View Table - Add, series is set as 'c' looking for selection values. Preacher is set as 'd', only selection values. Statistics 'e' is a list. It is multiple. [00:09:36](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m36s) These (preacher, series) single ones are part of the list query whereas the multiple of it would have its own method. In the Join DB table add the category as single and 'b' those values. [00:10:01](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m01s) Going back to the code, this is the getListquery in the getitem. After we received the items we look through them in getSermonstatistics and a generated string to ensure no conflicting with other methods on the page. Place the values in 'id sermonsstatisticsE'. [00:10:30](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m30s) This is where the values are placed. (See video.) We have a custom method here. Like we had shown in the dynamic get you can add custom methods and return the items to the page.
### Preacher view.html.php Generated Code
[00:10:55](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m55s)
In the page you have the file, view.html.php. If you open it there is a get items method being used to place the items in items. At the moment we are in the view which means that you can access this set of values inside of that class field. [00:11:26](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m26s) If we go back to our Component Builder, and select that method the items would be corresponding to our code. The id. and the asset_id, etc, are in there.
In the page, you have the file, view.html.php. If you open it there is a get items method being used to place the items in items. At the moment we are in the view which means that you can access this set of values inside of that class field. [00:11:26](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m26s) If we go back to our Component Builder, and select that method the items would be corresponding to our code. The id. and the asset_id, etc, are in there.
### Checking The Target Datasets
[00:11:48](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m48s)
If you scroll down there is a 'idsermonstatisticsE' which means that in the array there is a key value which has another set of array values in it. [00:12:03](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m03s) You can target these data sets by corresponding pointing values. That's just the main get. [00:12:28](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m28s) If we look at the other custom get that has been added, we'll see preacher, a custom method that has been added. It also has its set of values and database structure. (Remember we set it to be link to the preachers id.) I can check for the id, then set it to id, and return to result. [00:12:53](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m53s) The same goes with the number of downloads. It's also custom method that set to this view because of the custom get that was added. As we go back to our view.html.php file, those values are respectively being added to preacher number downloads and number sermons. [00:13:21](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m21s) You can use these values in the view by targeting with this number sermons.
If you scroll down there is a 'idsermonstatisticsE' which means that in the array there is a key-value which has another set of array values in it. [00:12:03](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m03s) You can target these data sets by corresponding pointing values. That's just the main get. [00:12:28](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m28s) If we look at the other custom get that has been added, we'll see preacher, a custom method that has been added. It also has a set of values and database structure. (Remember we set it to be linked to the preachers id.) I can check for the id, then set it to id, and return to result. [00:12:53](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m53s) The same goes for the number of downloads. It's also a custom method that set to this view because of the custom get that was added. As we go back to our view.html.php file, those values are respectively being added to preacher number downloads and number sermons. [00:13:21](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m21s) You can use these values in the view by targeting with this number sermons.
### Site Preacher Tmpl Folder