Updated 044 Hello World Component with Joomla Component Builder Creator Extended (markdown)
parent
a44a60b9ac
commit
6aab5e0789
@ -418,36 +418,36 @@ Add a link to James so that when you click it, will see the Greeting that James
|
|||||||
[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)
|
||||||
|
|
||||||
Add an alias to the Greeting. There is a shortcut to the Fields linked to an Admin area. It is this little icon below Greetings. We want to add another Field called Alias. In Fields there is already a Field called Alias, simply use that Field. Go back to the Admin Views and click on this shortcut icon below Greetings to add fields. [01:14:52](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m52s) Click the green plus button and add an Alias. Now (alignment) both of these Above Tabs are moved. An Alias is created in the second line. In Greetings, make it full-width Alignment. [01:15:18](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m18s) The Greetings will also be edited so that it is no longer a text field but a text area. With all in its place, Save and Close. Open the Greetings in Fields. Since there are some values that I want to stay the same, I am going to select the XML Definition and copy it. [01:15:51](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m51s)
|
Add an alias to the Greeting. There is a shortcut to the Fields linked to an Admin area. It is this little icon below Greetings. We want to add another Field called Alias. In Fields there is already a Field called Alias, simply use that Field. Go back to the Admin Views and click on this shortcut icon below Greetings to add fields. [01:14:52](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m52s) Click the green plus button and add an Alias. Now (alignment) both of these Above Tabs are moved. An Alias is created in the second line. In Greetings, make it full-width Alignment. [01:15:18](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m18s) The Greetings will also be edited so that it is no longer a text field but a text area. With all in its place, Save and Close. Open the Greetings in Fields. Since there are some values that I want to stay the same, I am going to select the XML Definition and copy it. [01:15:51](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m51s)
|
||||||
Then select 'Textarea' and paste that first XML in here, only in order to remove it again since it is just to copy and 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 not change the Type because the Type at the top of the page needs to correspond with the Type in the XML. Changing the type in the XML will not work. Keep the Label the same. We want to add 'greetings' as a description. We do not want to default text. [01:16:57](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m57s) Add the hint back again. We do not need any of these other fields, just remove them and do not want the filter to be set to 'raw'. We would rather use the word string since we do not want any HTML at this stage in our greetings. If you want HTML now in the greeting you can use the Save HTML. It is 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) The 'textarea' is in place and I am going to add 'class.'text_area span 12'. It is not certain how long that will be there as a class. Save and close. [01:18:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h18m11s) Since not any of the Database values with this text field had changed, there should not be any issues. But a new text field had been added. If the Component gets compiled in the Compiler, it may be seen that it dynamically incremented the version 2_0_1. If we go to the Component without installing, you will see that it has not updated the view because this was open. Before doing anything I would suggest that the view should be reopened and the page refreshed so that the changes can show.
|
Then select 'Textarea' and paste that first XML in here, only in order to remove it again since it is just to copy and 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 not change the Type because the Type at the top of the page needs to correspond with the Type in the XML. Changing the type in the XML will not work. Keep the Label the same. We want to add 'greetings' as a description. We do not want to default text. [01:16:57](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m57s) Add the hint back again. We do not need any of these other fields, just remove them and do not want the filter to be set to 'raw'. We would rather use the word string since we do not want any HTML at this stage in our greetings. If you want HTML now in the greeting you can use the Save HTML. It is not on 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) The 'textarea' is in place and I am going to add 'class.'text_area span 12'. It is not certain how long that will be there as a class. Save and close. [01:18:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h18m11s) Since not any of the Database values with this text field had changed, there should not be any issues. But a new text field had been added. If the Component gets compiled in the Compiler, it may be seen that it dynamically incremented the version 2_0_1. If we go to the Component without installing, you will see that it has not updated the view because this was open. Before doing anything I would suggest that the view should be reopened and the page refreshed so that the changes can 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)
|
||||||
|
|
||||||
Go back and install the new changes. Open a Hello World, the Alias should be seen there and if it is saved, it should dynamically add a new Alias. This has to be done for every item because the Aliases are saved or created only once the item is saved. Open the Aliases. Only ship this Component when everything in place otherwise the user has to do all this gymnastics to make sure that all the values are in place. If by some reason they have to, 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 with all our items set and it has an Alias, we can start working on those links.
|
Go back and install the new changes. Open a Hello World, the Alias should be seen there and if it is saved, it should dynamically add a new Alias. This has to be done for every item because the Aliases are saved or created only once the item is saved. Open the Aliases. Only ship this Component when everything in place otherwise the user has to do all these gymnastics to make sure that all the values are in place. If by some reason they have to, 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 with 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
|
||||||
|
|
||||||
[01:20:07](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h20m07s)
|
[01:20:07](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h20m07s)
|
||||||
|
|
||||||
There is one more place where a change needs to be done. That is in the Dynamic Get. If you remember when we set it up we did not include the Alias. Copy this(follow steps on video). Then change to another view and then return to this one to get the alias there. We got the alias. Save and close. <<<<<<<<<
|
There is one more place where a change needs to be done. That is in the Dynamic Get. If you remember when we set it up we did not include the Alias. Copy this(follow steps on video). Then change to another view and then return to this one to get the alias there. We got the alias. Save and close.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Check Whether Alias Brought To page By Adding a php.var_dump
|
### Check Whether Alias Brought To page By Adding a php.var_dump
|
||||||
|
|
||||||
[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)
|
||||||
|
|
||||||
It can be checked 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 return to the Compiler. 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 just the basics.
|
It can be checked 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 return to the Compiler. 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. The 'Alias' may be seen and that it created a slug. We got the slug for every item and that is the first step in setting up a well-formed link for opening one of these items.
|
||||||
|
|
||||||
### 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 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.
|
An 'href' is set up around this name but use PHP to take care of creating a link for us by simply type 'PHPecho'. The class name is found in the code, where there is a file called; 'route.php.' in the helpers class. [01:23:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h23m11s) If it is opened 'Hello_worldHelperRoute' may be seen. If you scroll down, the site view for the single record has not been added therefore some values are missing here. First, that should be done. There is a class that works together with this class. [01:23:48](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h23m48s) It is these two classes with their methods that we are going to use to build a link. <<<<<<<<<<<<<<<<
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Create Site View For The Single Record
|
### Create Site View For The Single Record
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user