From d6ca77737481772beb721f5c62b82eb529659bea Mon Sep 17 00:00:00 2001 From: Amigo <49749100+aamigo@users.noreply.github.com> Date: Thu, 6 Jun 2019 14:58:07 +0200 Subject: [PATCH] Updated 017 Layout Setup (markdown) --- 017-Layout-Setup.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/017-Layout-Setup.md b/017-Layout-Setup.md index 90b96ca..fbb2299 100644 --- a/017-Layout-Setup.md +++ b/017-Layout-Setup.md @@ -22,5 +22,29 @@ In layouts look for sermon list item. In sermon list item you will see that I'm Since I'm targeting a specific view, [00:04:02](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m02s) I'm using the view key, adding it to the string and checking what is the value for this specific view in the global of the component. On the basis of this I'm actually able to make this view very dynamic, and can use it through multiple layouts, based on that view key. I know if others want to use the layout in their components extending this one it possibly will not work that well. [00:04:31](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m31s) But since we are using it for our own component and really for our own implementation, I don't think that's too big a deal. At the same token I am able to check. Simply what is the view key? Is it preacher, series, or category? On a basis of that I ask different questions and have different implementation of certain values like series name, preacher name, and category. **Layout To Template Custom Scripting** -??? -There is another convention that I think is very worthwhile mentioning here, and that is the convention of actually [00:05:11](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m11s) in the template, we go back here(editing the template). We go to custom scripting. There is the [[[sview]]] placeholder. The [[[sview]]] placeholder will be replaced with the actual views name. Since we using a template here, you see this is a template, [00:05:32](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m32s) But this sermon list, that one I'm adding that template To multiple site views So I'm not just adding it to one site view I'm adding it to multiple site views But since I want this template again to be Dynamic so wherever I add it I I want it to dynamically Add That site views name here [00:05:57](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m57s) And then is as you can see I'm actually asking The global parameters For that site view sermon list style So That means Is is going to add For example preacher there or it's gonna add series there or is gonna add category there so it will say category sermons list style let me show you that in the code So now I have category open I've got preacher open as well as series [00:06:30](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m30s) And you can see That I'm adding sermon grit sermon list sermon table to them all sermon grid sermon list sermon table Sermon grit sermon list sermon table But if I was to open Sermon list in series You see that that name was changed to Series If I was gonna open Sermon list in preacher [00:06:53](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m53s) You see it was changed Preacher If I open it in category You see that it actually added category And that means that our Little Place holder Was dynamically updated by component Builder on the build And then It behaves as you expect now That you would know where is it getting these values [00:07:20](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m20s) If we If we go to the component in the backend And We open it's config File Scroll down We get you an area called preacher custom config Which is again this is a tab And tab's name is preacher and in this tab We have these value preacher display [00:07:48](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m48s) preacherbox contrast preacher list style And we scroll down we see preachers sermon count preacher email Preacher website and then preacher sermon display And preacher a sermon list display Now if we take that sermon List display And then search for it across The file say make it [00:08:13](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m13s) Cap sensitive we see that it has 6 matches So that means there is 6 places Actually 3 Because one of Each other 6 are in the comments one is category one is series And one is Preacher [00:08:33](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m33s) So those are the different the three different views Let make use of that series list style Now the Series list style Is then being implemented On the basis of That Dynamic updating of the string here And so it's simply getting the style Then doing a switch that when setting it accordingly And that is Another nice [00:08:57](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m57s) To have tool To again make a template More Dynamic so you can build a template And you can reuse it in multiple site views Simply with this place holders Which is called site view ,I should have mentioned that in the templates Explanation But since we only came across it now I mentioning it here Going back to the layouts Your layout [00:09:27](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m27s) Concept is more or less the same as templates It has a layout area in which you put your script and here you can see We are using that key replacing You can see that if you select certain Dynamic gets we are taking Liberty of showing you that we are starting with display data But this this Snippets here Might not correspond what you're doing because you can really pass anything to a layout And we are just assuming that if you're using that dynamic get you possibly passing it in this [00:10:06](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m06s) This way or that way So you can't just copy paste this necessarily But at least you can know when you look at a specific Dynamic get here What are the values in it And you know how you can sort of try figure out Which ones to use here This again will be only really Something you need to use If or can use if you are actually aware of our PHP and Everything will [00:10:34](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m34s) Do the implementations here And if you do not if you're not that familiar You don't need layouts I mean you can you can build your whole front-end right in your site view It might be a long lengthy script but it still work All the only reason we added layouts and templates is simply for our own convenience And if it's little confusing to you can even if you skip this whole area For the meantime Beginning layouts you have the same concept of adding custom scripting Which will be placed in the head of the file And remember that your Global data or in the data being passed is in [00:11:14](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m14s) Display data And then here again you have your HTML area But you can jump into PHP and Check the sum values and then on the basis of that to your certain implementations And That is really setting up a layout Just another note you can actually use a layout in a layout And you can pass it values as any value you like [00:11:42](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m42s) I realized that this here is maybe not that appropriate So you need to keep a heads up that This doesn't exist on the layout page You need to use the Display data as the global or as the main Object from which to start Your implementation OK that is layouts thank you for watching + +There is another convention that I think is very worthwhile mentioning here, and that is the convention of actually [00:05:11](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m11s) in the template, we go back here(editing the template). We go to custom scripting. There is the [[[sview]]] placeholder. The [[[sview]]] placeholder will be replaced with the actual views name. Since we using a template here, you see this is a template. [00:05:32](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m32s) This sermon list, that one, I'm adding that template to multiple site views. I'm not just adding it to one site view, I'm adding it to multiple site views. + +**Dynamic Custom Views using Template** + +Since I want this template again to be dynamic, so wherever I add it, I want it to dynamically add to that site views name. [00:05:57](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m57s) Then as you can see I'm actually asking the global parameters for that site view sermon list style. That means it is going to add for example preacher there, or it's going to add series there, or it is going to add category there. It will say category, sermons, list, style. + +**Above In The Code** + +Let me show you that in the code. I have category open, I've got preacher open, as well as series. [00:06:30](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m30s) You can see that I'm adding sermon-grid, sermon-list, sermon-table to them all. If I was to open sermon-list in series, you will see that name was changed to series. If I was going to open sermon-list in preacher, [00:06:53](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m53s) you will see it was changed preacher. If I open it in category, you will see that it added category. That means that our little place holder was dynamically updated by component builder on the build, then it behaves as you expect. + +**Config.xml** + +Now you would know where is it getting these values? [00:07:20](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m20s) If we go to the component in the back end, a we can open it's config file. Scroll down. We get an area called 'preacher_custom_config' which is a tab, and the tab's name is preacher. In this tab we have these: value_preacher_display, [00:07:48](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m48s) preacher_box_contrast, preacher_list_style. We scroll down, we see preachers_sermon_count, preacher_email, preacher_website, and then preacher_sermon_display, and preacher_sermon_list_display. Now if we take that sermon_list_display, and search for it across the file, say I make it [00:08:13](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m13s) cap sensitive, we see that it has 6 matches. That means there is 6 places, actually 3. Because one of the other 6 are in the comments, one is category one is series and one is preacher. [00:08:33](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m33s) Those are the three different views. Let make use of that series list style. Now the series list style is then being implemented on the basis of that dynamic updating of the string here. It's simply getting the style. Then doing a switch when setting it accordingly. that is another nice [00:08:57](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m57s) to have tool. To again make a template more dynamic. You can build a template and you can reuse it in multiple site views. Simply with this place holders which is called site view. I should have mentioned that in the templates explanation, but since we only came across it now I mentioning it here. + +**Layout Concept** + +Going back to the layouts. Your layout [00:09:27](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m27s) concept is more or less the same as templates. It has a layout area in which you put your script and here you can see we are using that(see video) key replacing. You can see that if you select certain dynamic gets, we are take the liberty of showing you that we are starting with display data. But this snippets here(see video), might not correspond what you're doing because you can really pass anything to a layout. We are just assuming that if you're using that dynamic get, you possibly passing it in this [00:10:06](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m06s) way or that way. You can't just copy and paste this necessarily. At least you can know when you look at a specific dynamic get here, what are the values in it? And how you can try figure out which ones to use here. This again will be only really something you need to use if or can use if you are actually aware of our php and everything will [00:10:34](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m34s) do the implementations here. And if you're not familiar, you don't need layouts. I mean you can build your whole front end right in your site view. It might be a long lengthy script, but it still work. The reason we added layouts and templates is simply for our own convenience. If it's little confusing to you, you can skip this whole area for the meantime. + +**Layout Custom Script Area** + +Begin at layouts you have the same concept of adding custom scripting. Which will be placed in the head of the file. Remember that your global data or the data being passed is in [00:11:14](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m14s) display data. Here again you have your html area. But you can jump into php and check some values and on the basis of that, do your certain implementations. That is really setting up a layout. + +**A Note: Use Layout in a Layout** + +Just another note you can actually use a layout in a layout. You can pass values, any value you like. [00:11:42](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m42s) I realized that 'this' here is maybe not that appropriate. You need to keep a heads up for that. This doesn't exist on the layout page. You need to use the display data as the global or as the main object from which to start your implementation.