Updated 013 dynamicGet (markdown)

Amigo 2019-06-18 10:03:02 +02:00
parent 39259d6040
commit 7f5fbebfa7
1 changed files with 5 additions and 3 deletions

@ -78,12 +78,14 @@ Then there is the 'Access'. We have a bunch of values that fire every time in a
That is setting up a 'getlistquery' with pagination through this ordering method we just says, use the 'a.ordering' [00:30:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m39s) and send. You can order all the items. Just add many as you like. Be sure that the table that you ordering, could even use a name. It could be a 'name' as an ordering table key. Then you could do a descending or ascending. It would be added to the query. [00:31:03](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m03s) That is also added ordering to the data set from your dynamic get method. Here with the joint view tables you can do very nice dependency calls from other tables in the back end, and bring the data together into one items array. [00:31:25](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m25s) That's what dynamic get is for. As it can be seen there is a main source on the model.
Then we have this other one called 'getpreacher'. [00:31:45](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m45s)That is another dynamic get function which we have looked at. It's called 'getpreacher'. If it is opened, it is a 'getcustom'. We gave it a custom name called 'getpreacher'. This is its relationships, in this instance it does not have any relationships. It does not link to other tables (See video) [00:32:04](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m04s) It simply gets the preachers details right there.(see video) But it has a filter which is basically using the same integer and access levels as the filters. It is using a 'where' and it can be seen that it is published, and that it does not need ordering, because it is one preacher. [00:32:41](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m41s) It doesn't have any global settings. That is 'getpreacher'. From this settings, Component Builder writes all this code. You'd see that we have this function everywhere called 'UIkitComp' and are we using a global static method, 'getuikitcomp'. It's a method that VDM has build. To get more acquinted with Uikit, go to 'getUIkit' or google it. It's a CSS JavaScript library, which really makes modeling of your views very easy. It has components that you can use, like tool tip and [00:33:45](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m45s) all these kind of models.<<<<
Then we have this other one called 'getpreacher'. [00:31:45](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m45s)That is another dynamic get function which we have looked at. It's called 'getpreacher'. If it is opened, it is a 'getcustom'. We gave it a custom name called 'getpreacher'. This is its relationships, in this instance it does not have any relationships. It does not link to other tables (See video) [00:32:04](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m04s) It simply gets the preachers details right there.(see video) But it has a filter which is basically using the same integer and access levels as the filters. It is using a 'where' and it can be seen that it is published, and that it does not need ordering, because it is one preacher. [00:32:41](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m41s) It doesn't have any global settings. That is 'getpreacher'. From this settings, Component Builder writes all this code. You'd see that we have this function everywhere called 'UIkitComp' and are we using a global static method, 'getuikitcomp'. It's a method that VDM has build. To get more acquinted with Uikit, go to 'getUIkit' or google it. It's a CSS JavaScript library, which really makes modeling of your views very easy. It has components that you can use, like tool tip and [00:33:45](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m45s) all these kind of models. Guardian is another component. Not all of it's components is loaded every time. We wrote it in PHP, a method that looks at text fields and editor fields. In this component this description field, is a editor field, and so we are sending it to this 'getuikitComp' method.
You can go look at this method in your helper class 'sermondistributor'. It has the classes that already has been identified which is what this [00:34:56](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h34m56s) initial model field value is actually holding. It is holding any component names that already has been identified. This gets passed also here(classes) with the content. Then we check in the content whether there is a class='uk-' and if it's not 'false', we start looping to check what are all the components that are in there. A list of the components that are available can be seen. On-the-fly it is determined whether these components should be loaded just by looking at the content that was placed in the description field and then it is added back to this array(see video). It updates this, eventually you have an array of all those items. [00:36:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m00s) In the view, go to the 'view' which in this case is going to be 'Preacher' and open 'view.html.php'. These are of the components that when Component Builder compiled the application, it looks inside of the content of your site view, as well as your custom admin view and it identify that these components must be loaded for uikit.<<<<<<<
Cordian is another component. We don't load all of it's components every time. What we've done is we've written in PHP, a method that looks at fields that are text area fields. It's not looking at every field, is only looking at the text fields and editor fields. In this component we know that this description field, is a editor field, and so we are sending it to this(getuikitComp) method.
You can go look at this method in your helper class(sermondistributor). It has the classes that already has been identified which is what this [00:34:56](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h34m56s) initial this field name, field value model field value is actually holding. It's holding any component names that already has been identified. This gets pass also here(classes) with the content. Then we check in the content whether there is a class='uk-' and if it's not false, we start looping to check what are all the components that are in there. Here is the list of the components that are available. On-the-fly we are determining whether these components should be loaded. Just by looking at the content that was placed in the description field. Then we added back to this array(see video). It updates this, eventually you have an array of all those items. In the view, we go to the view, [00:36:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m00s) which in this case is going to be preacher. We open the view .HTML. We get to a place where everything is going to be happening. These are of the components that when component builder compiled the application, it looks inside of the content of your site view, as well as your custom admin view and it identify that these components must be loaded for uikit. It places it here dynamically but since you could've added some components inside of the script that is stored in the description area, it now has this getuikitcomponent which reach back into the model. In the model gets this variables value through a method which is here at the bottom of the page. There it is [00:37:04](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m04s) getuikitComp. Through this method it is reaching in getting that array. Once it has that array we check whether it is set. Whether it is an array and if it is an array we set it to the array that is already on this page. Then over here we loop through that array we load in those components, CSS and JavaScript as required.
It places it here dynamically but since you could've added some components inside of the script that is stored in the description area, it now has this getuikitcomponent which reach back into the model. In the model gets this variables value through a method which is here at the bottom of the page. There it is [00:37:04](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m04s) getuikitComp. Through this method it is reaching in getting that array. Once it has that array we check whether it is set. Whether it is an array and if it is an array we set it to the array that is already on this page. Then over here we loop through that array we load in those components, CSS and JavaScript as required.
You can be sure that the uikits needed components will be loaded on the page. Simply by user adding some of that components to its description as style. Because the way uikit works is you just like Bootstrap you just add the class name to the specific div or html tag. Then it activates the needed scripting around it. Which is a nice library but it's [00:38:08](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m08s) quite heavy and you don't want it on the page every time. I know you could have done this through JavaScript. They have a way for you to do this through the JavaScript, but I do the most of the work in the html, to leave the load on the server, and that the browser already has much more leverage and freedom. That's why we added this feature. This is maybe beyond the scope of the dynamic get. It is all also placed in the query that is developed by dynamic get, that's partly why it fits. Once you've got your dynamic get set up, you will add these dynamic gets to either site views or to custom admin views. These dynamic gets is what gets the data for you. It's where you model the data that you want to work with. You can then [00:39:12](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h39m12s) use them in site views and custom admin views. Next stop we will look at adding it to a site view and how all of that works.