diff --git a/051-Dynamic-Router-Implementation-Explained.md b/051-Dynamic-Router-Implementation-Explained.md index abb8431..63ab0f4 100644 --- a/051-Dynamic-Router-Implementation-Explained.md +++ b/051-Dynamic-Router-Implementation-Explained.md @@ -46,6 +46,6 @@ Now the other place also need to change is 'series'. 'sermon' should also be 'se Let me go and illustrate this within the JCB interface. All I wanted to show you here is that we are targeting with this new dynamic implementation, [00:07:53](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m53s) this little snippet, this little area(see video). We are not replacing the whole method, because it is standard, there's not much to do in improving that, and if we do, it will be improving it for everyone. The build function is really working well. I haven't seen any issues with that. At the end of the day it seems like only the parse method needed a bit of an improvement. -### Changes In The Interface -??? -Let's go back to the interface and let me show you [00:08:22](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m22s) where we can make the changes to have the category render 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, [00:08:48](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m48s) and this one preacher would also say preacher. That's basically all we need to do and then this router will work without any errors. Ok So here in the interface you have site views Now the site views the ones who wanna make changes to his this preacher The series and the category now I'm gonna show this to you little bit [00:09:15](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m15s) Long winded but Bear with me It's just make sure everybody is on the same page If you open preacher You would see that it has a dynamic Get called Sermons preacher ID and it say get list query Ok so This is the one We want to change [00:09:35](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m35s) The get the dynamic get As well as speaking about serieses The same is true of that We have this List query get series ID Sermons that we also want to change And so we not changing it in the view The idea was That if we change it in the dynamic get it automatically [00:09:57](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m57s) Right to correct code to whatever view you add it because we've added some custom Scripting Sorry placeholders within the script So let's take the first one is this sermon Where is it Sermon series So in custom script we scroll down to the bottom there is now a new Tab here option here Add PHP Parse method in router little bit of explanation there [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 So you see it looks very familiar it's got his place holders And it has a specific It has a specific S View 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 gonna be used this this Dynamic get This Would be replaced with that specific site view's value Ok that's just to give you a heads up About the place holder and that's what makes it dynamic So that you can use it in any site view and it will automatically write this Because really the the display of the page is actually 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 And if there are multiple variables being passed [00:11:32](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m32s) To the URL You can obviously update that and Replace multiple values So Here we want to within this one Did the default option here will actually resolve our issue because Remember these two values were not the same JCB's Dynamic build actually changed this value to Sermon instead of [00:11:57](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m57s) Leaving it The same And there is a very good reason For that Usually this would be the correct response but in this case because of complexity I'm not gonna explain It isn't the correct response and so you want these two values to be the same And it is basically the site view's name So we could just save it close this The next one we wanna do is this sermon preacher And it was also [00:12:25](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m25s) Having the same issue basically So we We gonna do the the same kind of Just add the the custom Option To ensure that these two values remain the same And then the last but not least was this category It is also behaving Incorrectly And really it's only because it [00:12:47](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m47s) Didn't detect That this is actually category And that is primarily because it is using the Sermon table To to start instead In the Sermon table We have a joint here too category If you can see there And so it does load the category and [00:13:12](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m12s) the tweak You see that we are actually using This ID And this is a category ID So it should actually go look for the category And build the parse method based on the category And so here We also gonna Just Add [00:13:33](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m33s) A true To this getVar Which tells the getVar method that this is actually a category This this name In effect is actually gonna be ignored Because it's gonna not be looking for this tables value is gonna go to the category table And look for the value there Ok so this will resolve this this issue We can save and close this one [00:13:59](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m59s) So now we have Done some customisation to our router Just by adding those Values to the dynamic get If we compile our components now It will automatically fall back Unto those Values Just install again [00:14:21](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m21s) And now let's go look at the code So we see here That it did exactly what he wanted it added preacher preacher there And this is now Categories is true And We see the series is series And so now at least we know that this actual The router will behave correctly This is the first step of our improvement to the router [00:14:49](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m49s) It seems to me that we already have a very workable Situation and this is really gonna make it too much better There was also the idea of adding some custom scripting into the built Method And we will look at that And I invite You and anyone else too To get involved On this on GitHub just if you know how to improve his even more Then please [00:15:16](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m16s) I get in contact with me and let's let's work together This is so what we've done so far But like an all iterative developing concepts Will continue improving this To the point where it really serves as well And holds up with changes also happening in Joomla itself Ok well thanks for watching +### The Interface +???? +Let's go back to the interface and let me show you [00:08:22](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m22s) where we can make the changes to have the category render 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, [00:08:48](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m48s) and this one preacher would also say preacher. That's basically all we need to do and then this router will work without any errors. Here in the interface you have Site Views. The Site Views, the ones we want to make changes to his this preacher The series and the category now I'm gonna show this to you little bit [00:09:15](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m15s) Long winded but Bear with me It's just make sure everybody is on the same page If you open preacher You would see that it has a dynamic Get called Sermons preacher ID and it say get list query Ok so This is the one We want to change [00:09:35](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m35s) The get the dynamic get As well as speaking about serieses The same is true of that We have this List query get series ID Sermons that we also want to change And so we not changing it in the view The idea was That if we change it in the dynamic get it automatically [00:09:57](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m57s) Right to correct code to whatever view you add it because we've added some custom Scripting Sorry placeholders within the script So let's take the first one is this sermon Where is it Sermon series So in custom script we scroll down to the bottom there is now a new Tab here option here Add PHP Parse method in router little bit of explanation there [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 So you see it looks very familiar it's got his place holders And it has a specific It has a specific S View 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 gonna be used this this Dynamic get This Would be replaced with that specific site view's value Ok that's just to give you a heads up About the place holder and that's what makes it dynamic So that you can use it in any site view and it will automatically write this Because really the the display of the page is actually 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 And if there are multiple variables being passed [00:11:32](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m32s) To the URL You can obviously update that and Replace multiple values So Here we want to within this one Did the default option here will actually resolve our issue because Remember these two values were not the same JCB's Dynamic build actually changed this value to Sermon instead of [00:11:57](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m57s) Leaving it The same And there is a very good reason For that Usually this would be the correct response but in this case because of complexity I'm not gonna explain It isn't the correct response and so you want these two values to be the same And it is basically the site view's name So we could just save it close this The next one we wanna do is this sermon preacher And it was also [00:12:25](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m25s) Having the same issue basically So we We gonna do the the same kind of Just add the the custom Option To ensure that these two values remain the same And then the last but not least was this category It is also behaving Incorrectly And really it's only because it [00:12:47](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m47s) Didn't detect That this is actually category And that is primarily because it is using the Sermon table To to start instead In the Sermon table We have a joint here too category If you can see there And so it does load the category and [00:13:12](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m12s) the tweak You see that we are actually using This ID And this is a category ID So it should actually go look for the category And build the parse method based on the category And so here We also gonna Just Add [00:13:33](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m33s) A true To this getVar Which tells the getVar method that this is actually a category This this name In effect is actually gonna be ignored Because it's gonna not be looking for this tables value is gonna go to the category table And look for the value there Ok so this will resolve this this issue We can save and close this one [00:13:59](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m59s) So now we have Done some customisation to our router Just by adding those Values to the dynamic get If we compile our components now It will automatically fall back Unto those Values Just install again [00:14:21](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m21s) And now let's go look at the code So we see here That it did exactly what he wanted it added preacher preacher there And this is now Categories is true And We see the series is series And so now at least we know that this actual The router will behave correctly This is the first step of our improvement to the router [00:14:49](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m49s) It seems to me that we already have a very workable Situation and this is really gonna make it too much better There was also the idea of adding some custom scripting into the built Method And we will look at that And I invite You and anyone else too To get involved On this on GitHub just if you know how to improve his even more Then please [00:15:16](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m16s) I get in contact with me and let's let's work together This is so what we've done so far But like an all iterative developing concepts Will continue improving this To the point where it really serves as well And holds up with changes also happening in Joomla itself Ok well thanks for watching