Updated 051 Dynamic Router Implementation Explained (markdown)

Amigo 2019-09-04 13:29:29 +02:00
parent 85e3d47667
commit ec45010e84
1 changed files with 3 additions and 4 deletions

@ -73,9 +73,8 @@ The next one we are going to do is Sermon (Preacher id). [00:12:25](https://www
[00:12:39](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m39s)
Last but not least is the Category that behaves incorrectly and it is only because it did not detect that this is a category. [00:12:47](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m47s) That is primarily because it is using the Sermon table to start instead. In the Sermon table, we have a Joint here to the category that loads the category. [00:13:12](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m12s) <<<<<<<<<<<
Last but not least is the Category that behaves incorrectly and it is only because it did not detect that this is a category. [00:12:47](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m47s) That is primarily because it is using the Sermon table to start instead. In the Sermon table, we have a Joint here to the category that loads the category. [00:13:12](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m12s)
In the Tweak, the (JRequest) ID is used, and this is a category ID. It should go and look for the category and build the parse method based on the category. In Custom Script we are also going to add a 'true' to this getVar, which tells the getVar method that this is a category. [00:13:33](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m33s) This name in effect is going to be ignored because it is not going to look for the value of this table, it is going to the category table and look for the value there. This will resolve this issue. Save and close. [00:13:59](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m59s)
In the Tweak you will see that we are using (JRequest) ID, and this is a category ID. It should go look for the category and build the parse method based on the category. In Custom Script we are also going to 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 a category. This name in effect is going to be ignored. Because it's not going to look for the value of this table, it is going to the category table and look for the value there. This will resolve this issue. We can save and close. [00:13:59](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m59s)
Now we have done some customization to our Router just by adding those values to the Dynamic Get. If we compile our component now, it will automatically fall back to those values. Just install it again. [00:14:21](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m21s) Let's go look at the code. We see here that it did exactly what we wanted, it added preacher there. This category is true, and we see the series is series. At least we know that 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 going to make it so much better. There was also the idea of adding some custom scripting into the built method. We will look at that and I invite you and anyone else to get involved in this on GitHub. 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) get in contact with me and let's work together. This is what we've done so far. But like alliterative developing concepts we will continue improving this to the point where it serves as well and holds up with changes also happening in Joomla itself.
Now we have done some customization to our Router just by adding those values to the Dynamic Get. If we compile our component now, it will automatically fall back to those values. Just install it again. [00:14:21](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m21s) Let's go look at the code. It did exactly what we wanted, it added `preacher` there. This category is `true`, and we see the series is `series`. At least we know that 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) There was also the idea of adding some custom scripting into the built method. We will look at that and I invite you to get involved in this on GitHub. If you know how to improve this, please [00:15:16](https://www.youtube.com/watch?v=hYycPLbaMos&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m16s) get in contact with me and let's work together. This is what we have done so far. But like alliterative developing concepts we will continue improving this to the point where it serves us well and holds up with changes in Joomla.