Updated 051 Dynamic Router Implementation Explained (markdown)

Amigo 2019-09-04 11:18:07 +02:00
parent 9f9224ec6e
commit c6802b007a

@ -45,19 +45,19 @@ This is an error because we want to get the value, the `id` of the `preacher` is
Now the other place also needs to change is '`sermon`' it should also be '`series`' [00:06:43](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m43s) So this is where the guessing which JCB does dynamically did not match the complexity of our Dynamic Gets. As time goes on we might improve its guessing and get better ways of guessing correctly within the dynamics of the Dynamic Gets to build this case more effectively. [00:07:14](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m14s) Since it had not been done yet, the quickest way for us to resolve this and which most probably will be the most dynamic option, is to add a way to replace the snippet of code and target the specific view. You will never need to know what is the view when you do this because they are placeholders but only need to remember where you have added the Dynamic Get.
To illustrate this within the JCB interface. With this new dynamic implementation, the snippet in this area is targeted(follow on video). [00:07:53](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m53s) The whole method is not replaced, because it is standard, there is not much to do in improving that. The 'Build' function is working well. I have not seen any issues with that. At the end of the day, it seems like only the `parse` method needed a bit of an improvement.<<<<<<<
To illustrate this within the JCB interface. With this new dynamic implementation, the snippet in this area is targeted(follow on video). [00:07:53](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m53s) The whole method is not replaced, because it is standard, there is not much to do in improving that. The 'Build' function is working well. I have not seen any issues with that. At the end of the day, it seems like only the `parse` method needed a bit of an improvement.
### The Interface Where You Can Make Changes In Dynamic Gets
[00:08:19](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m19s)
Let us return to the interface to show where the changes can be made to have the `category` rendered correctly as well as the `preacher` and the `series`. Basically, make the changes so that `sermon` will say `series`, and this one will say `true`, and this one `preacher` would also say, `preacher`.[00:08:48](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m48s) That is all that needs to be done and the router will work without any errors. Here in the interface, are the Site Views that need to be changed, which are Preacher, Series and Category. [00:09:15](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m15s) If Preacher is opened, you will see that it has a Dynamic Get called 'Sermons' (preacher id) and it is a (getListQuery). This is the one that should be changed. [00:09:35](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m35s) The Dynamic Get, as well as Series', the same applies to that. There are Sermons (series id) (getListQuery) that also need to change. It is not changed in the view. The idea was that if it gets changed in the Dynamic Get it will automatically write the correct code to whatever view is added because we have added some Custom Placeholders within the script. <<<<<<<
Let us return to the interface to show where the changes can be made to have the `category` rendered correctly as well as the `preacher` and the `series`. Basically, make the changes so that `sermon` will say `series`, and this one will say `true`, and this one `preacher` would also say, `preacher`.[00:08:48](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m48s) That is all that needs to be done and the router will work without any errors. Here in the interface, are the Site Views that need to be changed, which are Preacher, Series and Category. [00:09:15](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m15s) If Preacher is opened, you will see that it has a Dynamic Get called 'Sermons' (preacher id) and it is a (getListQuery). This is the one that should be changed. [00:09:35](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m35s) The Dynamic Get, as well as Series', the same applies to that. There are Sermons (series id) (getListQuery) that also need to change. It is not changed in the view. The idea was that if it gets changed in the Dynamic Get it will automatically write the correct code to whatever view is added because we have added some Custom Placeholders within the script.
### Sermon (series id) - Heads Up For Placeholders
[00:10:06](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m06s)
Let's take the first one is Sermon (series id). In Custom Script we scroll down to the bottom, there is a new tab option here, Add PHP (parse Method)-in Router'. [00:10:29](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m29s) Click yes, and it will dynamically load what is, what I can consider the most basic implementation of that little snippet. You will see it looks very familiar it's got these placeholders. It has a specific sview placeholder. That's because we're dealing with the site view and it has to have this s in it to replace it with the site view name. [00:10:55](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m55s) So wherever this is going to be used, this Dynamic Get would be replaced with that specific site view's value. That's just to give you a heads up about the placeholder and that's what makes it dynamic, that you can use it in any site view and it will automatically write this. Because the display of the page is based on the database request. Which is built in the URL by the name of the view. As well as the ID of the element. If multiple variables are being passed [00:11:32](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m32s) to the URL, you can update that and replace multiple values. Here we want to within this one, the default option here will resolve our issue because remember these two values were not the same.
The first one is Sermon (series id). In Custom Script scroll down to the bottom, there is a new tab option here, Add PHP (parse Method)-in Router'. [00:10:29](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m29s) Click 'Yes', and it will dynamically load what can be considered the most basic implementation of that short snippet. It looks very familiar, it got these placeholders. It has a specific sview placeholder because we are dealing with the Site View and it has to have this 's' in it to replace it with the site view name. [00:10:55](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m55s) So wherever this is going to be used, this Dynamic Get would be replaced with that specific site view's value. That's just to give you a heads up about the placeholder and that's what makes it dynamic, that you can use it in any site view and it will automatically write this. Because the display of the page is based on the database request. Which is built in the URL by the name of the view. As well as the ID of the element. If multiple variables are being passed [00:11:32](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m32s) to the URL, you can update that and replace multiple values. Here we want to within this one, the default option here will resolve our issue because remember these two values were not the same.
### JCB Change sview to sermon