Updated 044 Hello World Component with Joomla Component Builder Creator Extended (markdown)
parent
103a257ab2
commit
665684009b
@ -307,19 +307,22 @@ Then there is a 'Joint' area which we are not going to use, but it is a very nic
|
|||||||
|
|
||||||
[00:53:36](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h53m36s)
|
[00:53:36](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h53m36s)
|
||||||
|
|
||||||
The next one is going to be 'Greeting'. We would like it to be one item. Do a Back-end View. Again from the Greetings(list). This time we want the name and a greeting. We can still use the 'Published'. We do not need 'Modify by', 'Version' or 'Ordering'. We could have left out the 'Hits' in the previous setup. A little tweak should be done to make sure that it does not allow someone to grab an unpublished value by just adding an ID in the URL or something. Custom Script is OK. [00:54:26](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h54m26s) We need to add a filter. The ID is going to be used. Passing the ID via the URL. So the State Key will be ID and it is going to be 'a.id' in Table Key, equals in 'Comparisons Operator'. It is this Filter Type that makes the item load. There are many ways to load items. Although it is a bit complex, it gives you the freedom and ability to build quite amazing things.<<<<<<<<<<<<<<<<<<<<
|
The next one is going to be 'Greeting'. We would like it to be one item. Do a Back-end View. Again from the Greetings(list). This time we want the name and a greeting. We can still use the 'Published'. We do not need 'Modify by', 'Version' or 'Ordering'. We could have left out the 'Hits' in the previous setup. A little tweak should be done to make sure that it does not allow someone to grab an unpublished value by just adding an ID in the URL or something. Custom Script is OK. [00:54:26](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h54m26s) We need to add a filter. The ID is going to be used. Passing the ID via the URL. So the State Key will be ID and it is going to be 'a.id' in Table Key, equals in 'Comparisons Operator'. It is this Filter Type that makes the item load. There are many ways to load items. Although it is a bit complex, it gives you the freedom and ability to build quite amazing things.
|
||||||
|
Please go and watch the tutorial on Dynamic Get on GitHub.
|
||||||
### Dynamic Get Tutorials On GitHub - Wiki
|
|
||||||
|
|
||||||
[00:55:07](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h55m07s)
|
|
||||||
|
|
||||||
Please go and watch the tutorial on Dynamic Get on GitHub. There is a place, I just show you called Wiki. In the Wiki, there are links to all the different tutorials. You should really watch all of that. My encouragement is to really watch everything. I have often seen people ask the question [00:55:35](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h55m35s) in the issue area which is dealt with in the tutorials. I'm sorry we all have a lot of things to do and so if I don't answer these questions but simply point you to the tutorial I hope you understand.
|
|
||||||
|
|
||||||
### Two Dynamic Gets Created - Second Return One Greeting
|
### Two Dynamic Gets Created - Second Return One Greeting
|
||||||
|
|
||||||
[00:55:52](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h55m52s)
|
[00:55:52](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h55m52s)
|
||||||
|
|
||||||
We've got in the Dynamic Get all the value selected that we want and also how to limit it. The tweak is in place and the limiting factors. We don't need to join it to any other tables, we simply going to [00:56:09](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h56m09s) return these values. We could add the username values if we wanted. We wanted to show who created this. We could say created by, go to Joint, click on the Join Database Tables not Join View Tables because we want to use the user table and we want a single [00:56:46](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h56m46s) item returned and on Field it will be a.created_by and in the Joint Field it will be b.id and we want the username. We don't need the id, we already got that so just the user_name. We could just say [00:57:19](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h57m19s) greeted_by. He's the one sending the greeting. Save and close. Now we've got two Dynamic Gets, a Listgreeting, and a greeting. This is what you need to build first. Again starting at the Database looking at what is the data I want [00:57:54](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h57m54s) on the page? What do I want to show the people looking at the page? By that determining what the data is going to grab from the Database and giving it system names that are identifiable.
|
In the Dynamic Get all the values are selected that we want and can limit it. The tweak is in place and the limiting factors. It is not necessary to join it to any other tables, these values simply need to be returned.[00:56:09](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h56m09s) We could have added the username values if we wanted to. We want it to show who created this and say 'Created by', go to 'Joint', click on the 'Joint Database Tables' not 'Joint View Tables' because we want to use the 'User table' and want a single item returned and on 'Field' it will be 'a.created_by' and in the 'Joint Field' it will be 'b.id'. The 'Username' is needed but not the ID, it is already there, so only the 'user_name' is necessary. [00:57:19](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h57m19s) Use 'greeted_by', it is the one sending the greeting. Save and close. Now there is two 'Dynamic Gets', a 'Listgreeting', and a 'greeting'.<<<<<<<<<<<<
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<<<<<<<<<
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
This is what you need to build first. Again starting at the Database looking at what is the data I want [00:57:54](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h57m54s) on the page? What do I want to show the people looking at the page? By that determining what the data is going to grab from the Database and giving it identifiable system names.
|
||||||
|
|
||||||
### Next To Do - Create A Site View
|
### Next To Do - Create A Site View
|
||||||
|
|
||||||
@ -356,19 +359,19 @@ Now over here at Main Get, we are going to select the Listgreetings(name only) a
|
|||||||
|
|
||||||
[01:01:42](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h01m42s)
|
[01:01:42](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h01m42s)
|
||||||
|
|
||||||
We want the Listgreetings and so this Listgreetings gives us a few Snippets. Do know that the Snippets are not always accurate because it's very difficult for me to always know exactly how the implementation is going to work out. I'm giving you a snippet which is how I expect you to use the data. You can adjust that and this is where your knowledge of PHP will [01:02:10](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h02m10s) come into play. You should know what this and that little arrow items is because we are working with an object. You must know what it means? How to use an object? How to interact with an object? How to parse over it? How to grab its values? How to update its values? All this is part of your own background that you need to bring to JCB. JCB is not going to crank out customized Site Views the way it does the Admin Views. My idea was when it comes to Site Views I always want to do something different and I just want to have the ease of getting all the data on the page and then be creative. I haven't spent much time to make this as automatic, I want to set up of the back end and the Admin Views because this is what makes your component different from every other [01:03:15](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h03m15s) Component out there. We want to encourage you to do you do a lot of preparation and thinking about Data Structures in relationships because your Dynamic Get can grab from so many data places and bring all that data to you in a nice object which you can then parse and display with a lot of permission switches as I will show you in a moment. That is giving you a little backdrop on why the Dynamic Get and the Site View even the Custom Admin View, it's relationship and why it is like that.
|
We want the Listgreetings and so this Listgreetings gives us a few Snippets. Do know that the Snippets are not always accurate because it's very difficult for me to always know exactly how the implementation is going to work out. I'm giving you a snippet which is how I expect you to use the data. You can adjust that and this is where your knowledge of PHP will [01:02:10](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h02m10s) come into play. You should know what this and that little arrow items is because we are working with an object. You must know what it means? How to use an object? How to interact with an object? How to parse over it? How to grab its values? How to update its values? All this is part of your background that you need to bring to JCB. JCB is not going to crank out customized Site Views the way it does the Admin Views. My idea was when it comes to Site Views I always want to do something different and I just want to have the ease of getting all the data on the page and then be creative. I haven't spent much time to make this as automatic, I want to set up of the back end and the Admin Views because this is what makes your component different from every other [01:03:15](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h03m15s) Component out there. We want to encourage you to do you do a lot of preparation and thinking about Data Structures in relationships because your Dynamic Get can grab from so many data places and bring all that data to you in a nice object which you can then parse and display with a lot of permission switches as I will show you in a moment. That is giving you a little backdrop on why the Dynamic Get and the Site View even the Custom Admin View, it's relationship and why it is like that.
|
||||||
|
|
||||||
* ### Looping Through Items
|
* ### Looping Through Items
|
||||||
|
|
||||||
[01:03:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h03m58s)
|
[01:03:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h03m58s)
|
||||||
|
|
||||||
Basically looping through those items is this these two strings and is all we need. I could grab a list view(select a snippet). We are busy working on adding the Bootstrap Library to JCB. At the moment we got UIkit version 2 linked to JCB. And I've selected the list option for this Uikit. Uikit is a library developed by YOOtheme. If you do not know UiKit I would encourage you to go Google that and then [01:04:46](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h04m46s) you'll see it's quite a nice library to use. We have voted that Bootstrap is the better one and so we are migrating to Bootstrap. We will still support UiKit as much as we can. We are going to loop over the items. Show the name. Nothing is yet clickable, nothing is editable. It is to get you introduced to using Site Views. Save and close.
|
Looping through those items is this these two strings and is all we need. I could grab a list view(select a snippet). We are busy working on adding the Bootstrap Library to JCB. At the moment we got UIkit version 2 linked to JCB. And I've selected the list option for this Uikit. Uikit is a library developed by YOOtheme. If you do not know UiKit I would encourage you to go Google that and then [01:04:46](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h04m46s) you'll see it's quite a nice library to use. We have voted that Bootstrap is the better one and so we are migrating to Bootstrap. We will still support UiKit as much as we can. We are going to loop over the items. Show the name. Nothing is yet clickable, nothing is editable. It is to get you introduced to using Site Views. Save and close.
|
||||||
|
|
||||||
### Back To Component Add Site View
|
### Back To Component Add Site View
|
||||||
|
|
||||||
[01:05:18](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h05m18s)
|
[01:05:18](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h05m18s)
|
||||||
|
|
||||||
Now we going to go back to our Component and we are going to add the Site View to it. You might ask why don't we just add the Component to the Site View when we create the Site View? That was an idea that I did play with. But because of Database relationships and all kinds of reasons I felt that the better approach would be to link Site Views at the Component area instead of at the Site area. This gives us the option to use Site Views quite easily within other Components. That was really the idea behind it We might rethink this and we might reshuffle this in the future. I mean this is the first time I build such a Component called JCB. Who knows what happens if we start refactoring it in a more Advancement program is get involved. It might become even far better than it is now. [01:06:20](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h06m20s) This is how it works at the moment.
|
Now we going to go back to our Component and we are going to add the Site View to it. You might ask why don't we just add the Component to the Site View when we create the Site View? That was an idea that I did play with. But because of Database relationships and all kinds of reasons I felt that the better approach would be to link Site Views at the Component area instead of at the Site area. This gives us the option to use Site Views quite easily within other Components. That was the idea behind it We might rethink this and we might reshuffle this in the future. I mean this is the first time I build such a Component called JCB. Who knows what happens if we start refactoring it in a more Advancement program is get involved. It might become even far better than it is now. [01:06:20](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h06m20s) This is how it works at the moment.
|
||||||
|
|
||||||
### Creating A Site View
|
### Creating A Site View
|
||||||
|
|
||||||
@ -380,7 +383,7 @@ So you go to Site Views and click Create Linked Site Views. Then you select that
|
|||||||
|
|
||||||
[01:07:09](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h07m09s)
|
[01:07:09](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h07m09s)
|
||||||
|
|
||||||
If we go back to compiling our Component there are no changes being done to the Database.
|
If we go back to compiling our Component no changes are being done to the Database.
|
||||||
|
|
||||||
* ### Heads Up - When Updating Your Component It Automatically Updates The Database
|
* ### Heads Up - When Updating Your Component It Automatically Updates The Database
|
||||||
|
|
||||||
@ -400,7 +403,7 @@ Just a heads up. When you add a front end Site View and you set that to default
|
|||||||
|
|
||||||
[01:09:53](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h09m53s)
|
[01:09:53](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h09m53s)
|
||||||
|
|
||||||
Before you can add the Greetings to a Site Menu. We've got at least four Greetings in place. We can add that list view to an Front and Site view. We go to Menus and go to Main Menu. Select the Menu type. Click Hello World Greetings that was the previous Component. We've got Greeting set as the HOME of this website. We going to click save and close. [01:10:54](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h10m54s) There we go. We've got HOME and Hello World Greetings. That should mean that if we click on this preview(demonstration button) the front end of the Site, we should see the Greetings. It's going to say 'The page isn't redirecting properly'.
|
Before you can add the Greetings to a Site Menu. We've got at least four Greetings in place. We can add that list view to an Front and Site view. We go to Menus and go to Main Menu. Select the menu type. Click Hello World Greetings that was the previous Component. We've got Greeting set as the HOME of this website. We going to click save and close. [01:10:54](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h10m54s) There we go. We've got HOME and Hello World Greetings. That should mean that if we click on this preview(demonstration button) the front end of the Site, we should see the Greetings. It's going to say 'The page isn't redirecting properly'.
|
||||||
|
|
||||||
### Set Front Site View To Have Access Control
|
### Set Front Site View To Have Access Control
|
||||||
|
|
||||||
@ -418,21 +421,21 @@ The manual way to do this is to go to the Hello World Component, click on Option
|
|||||||
|
|
||||||
[01:13:00](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h13m00s)
|
[01:13:00](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h13m00s)
|
||||||
|
|
||||||
Let's add a link to James so that when you click it you actually see the Greeting that James should receive. We go back to the Site Views and we open the Greetings. Now we want to add a link. But there is a better way of doing a link in JCB which takes care of all the [01:13:27](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h13m27s) controller issues. When I go to the front end of the Component then we open the models for greetings.php, we will see that there is the getItems method. And in it we are checking whether this item has an alias. If it does have an ($item->id) and an ($item->id), it creates what is known as a $item->slug. This ($item->alias) and ($item->id) is combined [01:13:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h13m58s) into the $item->slug. Since we know that our greetings area does not have an alias. In fact it only has an id. It will only end up with an id in the slug.
|
Let's add a link to James so that when you click it you see the Greeting that James should receive. We go back to the Site Views and we open the Greetings. Now we want to add a link. But there is a better way of doing a link in JCB which takes care of all the [01:13:27](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h13m27s) controller issues. When I go to the front end of the Component then we open the models for greetings.php, we will see that there is the getItems method. And in it, we are checking whether this item has an alias. If it does have an ($item->id) and an ($item->id), it creates what is known as a $item->slug. This ($item->alias) and ($item->id) is combined [01:13:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h13m58s) into the $item->slug. Since we know that our greetings area does not have an alias. It only has an id. It will only end up with an id in the slug.
|
||||||
|
|
||||||
### Adding An Alias
|
### Adding An Alias
|
||||||
|
|
||||||
[01:14:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m11s)
|
[01:14:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m11s)
|
||||||
|
|
||||||
Let's go add an alias to our Greeting. There is a shortcut to the Fields linked to an Admin area. It's this little icon underneath Greetings. We want to add another Field called Alias. If you go to the Fields we'll see that there is already a Field called Alias. We can simply use that Field. Go back to the Admin Views and we'll click on this shortcut icon underneath Greetings for adding fields. We going to [01:14:52](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m52s) click the green plus button and add an Alias. We going to tell the system that this is an Alias. Now we are moving(alignment) both of these Above Tabs. We are creating the Alias to be second in line. In the Greetings we are going to make it a full width in Alignment. [01:15:18](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m18s)
|
Let's go add an alias to our Greeting. There is a shortcut to the Fields linked to an Admin area. It's this little icon underneath Greetings. We want to add another Field called Alias. If you go to the Fields we'll see that there is already a Field called Alias. We can simply use that Field. Go back to the Admin Views and we'll click on this shortcut icon underneath Greetings for adding fields. We going to [01:14:52](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m52s) click the green plus button and add an Alias. We going to tell the system that this is an Alias. Now we are moving(alignment) both of these Above Tabs. We are creating the Alias to be second in line. In the Greetings, we are going to make it full width in Alignment. [01:15:18](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m18s)
|
||||||
|
|
||||||
We also going to go edit the Greetings in a moment so that it's no longer a text field but a text area. We got all in its place, save and close. Going back to Fields, I'm going to open the Greetings. Since there are some values I want to stay the same. I am going to select [01:15:51](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m51s) the XML Definition and I'm going to copy it. Then I'm going to select Textarea. I'm going to paste that first XML in here. We have to remove it again but just so I can copy, paste. [01:16:13](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m13s) Cut the name. I want to keep the same name. You can't change the type because the Type up at the top of the page needs to correspond with the type in the XML. Changing the type in the XML will not work. The label you want to keep that the same. We want to add greetings as a description. We don't want to default text. [01:16:57](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m57s) Let's add the hint back again. We don't need any of these other fields, so we can just remove them. We don't want the filter to be set to raw. We would rather use the word string. Since we don't want any HTML at this stage in our greetings. If you want HTML now in the greeting you can use the Save HTML. I see it's not in this list but it does exist. Usually we would use the editor instead of just a textarea. [01:17:43](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h17m43s) We got our textarea replace and I'm going to add 'class.'text_area span 12'. I don't know how long that's going to still be there as a class. I think it is still there. I think that should do it. Save and close. [01:18:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h18m11s) Since we didn't change any of the Database values with this text field, we shouldn't have any issues. But we did add a new text field. If we go to the Compiler and we compile the Component, you will see that it dynamically incremented the version 2_0_1. If we go without installing we go to the Component you will see that it hasn't updated the view because this was open. Before doing anything I would suggest reopening the view, refresh the page. So that the changes will show.
|
We also going to go edit the Greetings in a moment so that it's no longer a text field but a text area. We got all in its place, save and close. Going back to Fields, I'm going to open the Greetings. Since there are some values I want to stay the same. I am going to select [01:15:51](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m51s) the XML Definition and I'm going to copy it. Then I'm going to select Textarea. I'm going to paste that first XML in here. We have to remove it again but just so I can copy, paste. [01:16:13](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m13s) Cut the name. I want to keep the same name. You can't change the type because the Type up at the top of the page needs to correspond with the type in the XML. Changing the type in the XML will not work. The label you want to keep that the same. We want to add greetings as a description. We don't want to default text. [01:16:57](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m57s) Let's add the hint back again. We don't need any of these other fields, so we can just remove them. We don't want the filter to be set to raw. We would rather use the word string. Since we don't want any HTML at this stage in our greetings. If you want HTML now in the greeting you can use the Save HTML. I see it's not in this list but it does exist. Usually, we would use the editor instead of just a textarea. [01:17:43](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h17m43s) We got our textarea replace and I'm going to add 'class.'text_area span 12'. I don't know how long that's going to still be there as a class. I think it is still there. I think that should do it. Save and close. [01:18:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h18m11s) Since we didn't change any of the Database values with this text field, we shouldn't have any issues. But we did add a new text field. If we go to the Compiler and we compile the Component, you will see that it dynamically incremented the version 2_0_1. If we go without installing we go to the Component you will see that it hasn't updated the view because this was open. Before doing anything I would suggest reopening the view, refresh the page. So that the changes will show.
|
||||||
|
|
||||||
### Install The New Changes
|
### Install The New Changes
|
||||||
|
|
||||||
[01:19:01](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h19m01s)
|
[01:19:01](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h19m01s)
|
||||||
|
|
||||||
We can go back and install the new changes. If we go to a Hello World we should be able to open the Hello World and we should see the Alias there and if we click save, it should dynamically add a new Alias. We'll have to do this for every item, because the Aliases are saved or created only once you saved the item. I'm just opening all of them quickly. Usually a user using your Component, you only going to ship this Component when you've got everything in place. They wouldn't have to do all this gymnastics to make sure that all the values are in place. If by some reason you will have to help them along with some Custom Scripting. [01:19:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h19m58s) Now that we got all our items set and it has an Alias, we can start working on those links.
|
We can go back and install the new changes. If we go to a Hello World we should be able to open the Hello World and we should see the Alias there and if we click save, it should dynamically add a new Alias. We'll have to do this for every item because the Aliases are saved or created only once you saved the item. I'm just opening all of them quickly. Usually, a user using your Component, you only going to ship this Component when you've got everything in place. They wouldn't have to do all this gymnastics to make sure that all the values are in place. If by some reason you will have to help them along with some Custom Scripting. [01:19:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h19m58s) Now that we got all our items set and it has an Alias, we can start working on those links.
|
||||||
|
|
||||||
### Changes To Be Made In Dynamic Get - Including Alias
|
### Changes To Be Made In Dynamic Get - Including Alias
|
||||||
|
|
||||||
@ -444,19 +447,19 @@ There's one more place we need to make a change. That is in the Dynamic Get. If
|
|||||||
|
|
||||||
[01:20:46](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h20m46s)
|
[01:20:46](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h20m46s)
|
||||||
|
|
||||||
We can check whether this alias is being brought to the page by adding a php.var_dump. [01:21:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h21m11s) We take all the $this>items, copy, paste it in there php.var_dump($this>items) and save. Now we go back to the Compiler. I'm just quickly compile this again and install. Go to the homepage [01:21:44](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h21m44s) refresh and now you will see that it dumps all the values on the page and then displace them. We can look and see there's the Alias and it created that slug we spoke about. We got the slug for every item and that is the first step in setting up a well-form link for opening one of these items. [01:22:13](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h22m13s) I don't know what some of you might think, that's got a lot of things to do to get this to work. I can tell you if you want to build Components for Joomla and you want to go outside of the box and build things that are unique and completely different from what other people are doing and this is really just the basics.
|
We can check whether this alias is being brought to the page by adding a php.var_dump. [01:21:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h21m11s) We take all the $this>items, copy, paste it in there php.var_dump($this>items) and save. Now we go back to the Compiler. I'm just quickly compiling this again and install. Go to the homepage [01:21:44](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h21m44s) refresh and now you will see that it dumps all the values on the page and then displace them. We can look and see there's the Alias and it created that slug we spoke about. We got the slug for every item and that is the first step in setting up a well-form link for opening one of these items. [01:22:13](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h22m13s) I don't know what some of you might think, that's got a lot of things to do to get this to work. I can tell you if you want to build Components for Joomla and you want to go outside of the box and build things that are unique and completely different from what other people are doing and this is just the basics.
|
||||||
|
|
||||||
### Use PHP For Creating A Link
|
### Use PHP For Creating A Link
|
||||||
|
|
||||||
[01:22:36](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h22m36s)
|
[01:22:36](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h22m36s)
|
||||||
|
|
||||||
We going to setup a href here around this name. But we are going to use php to take care of creating a link for us. Here we are simply going to say php echo. I'm going to go and show you where we get the class name for what we want to do here. Back in the code you will see that there is in the helpers class a [01:23:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h23m11s) file called route.php. You can open that and you'll see that you have what is now called Hello_worldHelperRoute. If you scroll down, we don't have this stage have. Oh yes we haven't added the the site view for the single record. So there are some values missing here. I should have first done that. I'll go do that now, but we'll come back to this file. There is another file or I should say class that works together with this class .[01:23:48](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h23m48s) It's these two classes with their methods that we were going to use to build our link.
|
We going to set up a href here around this name. But we are going to use PHP to take care of creating a link for us. Here we are simply going to say PHP echo. I'm going to go and show you where we get the class name for what we want to do here. Back in the code, you will see that there is in the helpers class a [01:23:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h23m11s) file called route.php. You can open that and you'll see that you have what is now called Hello_worldHelperRoute. If you scroll down, we don't have this stage have. Oh yes, we haven't added the site view for the single record. So some values are missing here. I should have first done that. I'll go do that now, but we'll come back to this file. There is another file or I should say class that works together with this class . [01:23:48](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h23m48s) It's these two classes with their methods that we were going to use to build our link.
|
||||||
|
|
||||||
### Create Site View For The Single Record
|
### Create Site View For The Single Record
|
||||||
|
|
||||||
[01:23:56](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h23m56s)
|
[01:23:56](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h23m56s)
|
||||||
|
|
||||||
Let's create that display Site View. So I've removed the var_dump from this view. I'm going to save and close this. I could have set save a new. I'm going to create another Site View. We are going to call this Greet. We can't call it greeting because like we said there is already a greeting in the front. Or Greeted that one might be better. We going to make a nice display here. I'm using [01:24:40](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h24m40s) Panel. I'm going to copy the Panel Snippet and paste it in Default View. The title I'm going to make the name. The content will be the greeting. Now I don't want two of those, so I'm going to take out this one. [01:25:08](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h25m08s) I basically got one greeting setup here. There's no buttons here yet to edit it. But he will basically view one Greeting. It will also show you who setup the greeting. We can close this. We got this Greeted Site View. We can go to the Admin area [01:25:36](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h25m36s) of the Joomla Component area. I'm going to click on Edit. And actually add a Site View to the Component. Same way we did before. Can I say I want Greeted. I don't want it to have an Add Menu. It must have Has Metadata. [01:25:59](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h25m59s) It's not a Default View. I also want Access there. By Default it's not Public. Save and close. We'll Compile the Component again. I've compiled and install it.
|
Let's create that display Site View. So I've removed the var_dump from this view. I'm going to save and close this. I could have set save a new. I'm going to create another Site View. We are going to call this Greet. We can't call it greeting because like we said there is already a greeting in the front. Or Greeted that one might be better. We going to make a nice display here. I'm using [01:24:40](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h24m40s) Panel. I'm going to copy the Panel Snippet and paste it in Default View. The title I'm going to make the name. The content will be the greeting. Now I don't want two of those, so I'm going to take out this one. [01:25:08](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h25m08s) I got one greeting setup here. There are no buttons here yet to edit it. But he will view one Greeting. It will also show you who set up the greeting. We can close this. We got this Greeted Site View. We can go to the Admin area [01:25:36](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h25m36s) of the Joomla Component area. I'm going to click on Edit. And add a Site View to the Component. The same way we did before. Can I say I want Greeted. I don't want it to have an Add Menu. It must have Has Metadata. [01:25:59](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h25m59s) It's not a Default View. I also want Access there. By Default it's not Public. Save and close. We'll Compile the Component again. I've compiled and install it.
|
||||||
|
|
||||||
### Back In The Code
|
### Back In The Code
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user