Updated 014 Adding dynamicGet to a Site View (markdown)

Amigo 2019-06-13 12:03:39 +02:00
parent c9dd1c40fa
commit a921b5210f
1 changed files with 4 additions and 4 deletions

@ -31,16 +31,16 @@ Let's look at how Custom Gets methods are becoming available in your view by goi
### Looking At The Dynamic Get
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. We will look at that quickly, and then we see in the Join DB table - add that we have category as single, as 'b' those values. Going back to the code. [00:10:01](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m01s) This is the getListquery, in the getitem after we have received the items, we look through them and then in this function here getSermonstatistics and then a generated string(Fcff_E) to ensure no conflicting with other methods on the page. Puts the values in 'id sermonsstatisticsE'. [00:10:30](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m30s) That's where the values are placed. We have a custom method here. Like we shown in the dynamic get you can add custom methods, and returns 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 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.
### Preacher view.html.php Generated Code
In the page you have a file that is called: [00:10:55](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m55s) view.html.php. If you open the file you see that there is a get items method being used to place the items in items. At the moment we are actually in the view at this stage. That means 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, you would see if we were to select that(sermon (preacher.id)(getlist)) method, there is the items corresponding to our code. We know that the id. and the asset_id, in all these are in there.
In the page you have the file, view.html.php. [00:10:55](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m55s) 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
If you scroll down, you will see that there is a 'idsermonstatisticsE'. So that means in the array there is a [00:12:03](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m03s) key value which has another set of array values in it. You can target these data sets by corresponding pointing values. That is just looking at the main get. If we were to look at the other custom get [00:12:28](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m28s) that is been added. We'll see that here's preacher, which is a custom method that is been added. It also has its set of values and it's database structure and remember we set that we want it to be link to the preachers id. So can I check for the id, [00:12:53](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m53s) and then set it to id, returns to result. 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. Here is the numbersermons. As we go back to our view.html.php file, we see that those values are respectively being added [00:13:21](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m21s) to preacher. number downloads, and number sermons. 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 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.
### Site Preacher Tmpl Folder
Now the view itself is, as you should know inside of the template folder, under the views preacher. This main view as we call it or the default view, is where that code that we on the page that we looking at [00:13:50](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m50s) being placed. All these others are the templates that are extending the site view. They possibly are extended through layouts that are available in the layouts folder. We are just looking at adding the custom get methods to the page in our next to tutorial. We are going in depth about adding templates to your custom site view, and making use of these data sets. [00:14:24](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m24s) That is how you link them, your first create the custom get, then you come here, you link these. So these are the linking fields and these are just so that you can see the code snippets are making use of these fields respectively. That is custom gets added to site view.
The view itself is under the views preacher inside of the template folder. This main view, or default view, is where the code is on the page. [00:13:50](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m50s) These others are the templates extending the site view. They are extended through layouts available in the layouts folder. [00:14:24](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m24s)