WEBVTT

00:00.590 --> 00:03.680
I'll call you back again to another lecture in PHP.

00:03.680 --> 00:09.200
And in this video lecture I'll go ahead and teach you about include HTML in PHP.

00:16.220 --> 00:24.710
Okay, so in PHP you might want to be able to partition your files into different segments.

00:24.710 --> 00:30.740
Maybe you want to create a header file and then want to create body and footer and order parts like

00:30.740 --> 00:33.290
blocks and code into different files.

00:33.530 --> 00:39.350
Let me say I'm building a website, and I want to have the header file or the header to be in a file.

00:39.380 --> 00:41.540
I want to have the footer to be in a file.

00:41.570 --> 00:47.210
I want to have the body to be in another file, and I want to have the blog page to be in another file.

00:47.210 --> 00:52.460
So instead of building everything in just one file like site dot php, having the header, the body,

00:52.490 --> 01:00.020
the footer, the block, everything, and uh, it might look like, wow, this is really not going to

01:00.020 --> 01:03.110
be good if you want to manage that website tomorrow.

01:03.140 --> 01:05.600
Now I created different files.

01:05.600 --> 01:07.820
One is header dot HTML.

01:07.820 --> 01:12.080
Another is welcome to PHP Website.

01:12.080 --> 01:16.940
And I have another one that says beautiful website, that is the body dot HTML.

01:16.940 --> 01:23.810
And I have the footer dot HTML and it says, uh, all rights reserved.

01:24.320 --> 01:30.740
Now I can go to my HTML site and I can say, this is where I'm building my HTML document.

01:30.740 --> 01:31.880
And this file.

01:31.910 --> 01:39.650
I'll go ahead and uh, put in HTML and then I'll go ahead and close that.

01:40.520 --> 01:42.440
Now I have this thing right in here.

01:42.470 --> 01:46.250
I can build import in the the header file.

01:46.280 --> 01:48.350
First I'm going to say the header.

01:48.380 --> 01:50.990
I'll go ahead and just use what is called include.

01:50.990 --> 01:53.840
And then go ahead and put this in a string format.

01:53.870 --> 01:57.080
And I'll go ahead and say header dot HTML.

01:57.110 --> 02:00.560
If I should save this and go run this code we have.

02:00.590 --> 02:02.570
Welcome to PHP website.

02:02.570 --> 02:08.360
So if I want to actually change anything on that here let me say I have this header is too big and I

02:08.360 --> 02:09.530
want to go here.

02:09.530 --> 02:16.610
I can go right into the file and maybe I can reduce this to H2 and uh do that.

02:16.640 --> 02:18.680
This is a H2.

02:18.710 --> 02:22.400
I can now go ahead and save this without touching sites dot php.

02:22.430 --> 02:27.410
If I refresh this, you can see that this has been amended and we have this in one line.

02:27.440 --> 02:29.900
Welcome to PHP website.

02:29.900 --> 02:33.920
So in that way it will be easier for you as a developer to manage your site.

02:33.950 --> 02:39.710
You can actually go to different pages and work on them without touching this array.

02:39.740 --> 02:42.830
So I can actually go back right here and copy this.

02:42.830 --> 02:46.400
And then I'm going to paste that from body dot HTML.

02:46.400 --> 02:52.250
And if I should go ahead and change the body I'll go ahead and put this to be body dot HTML.

02:52.250 --> 02:55.670
So remember that this is just a template.

02:55.670 --> 02:59.960
And you can actually go ahead and make yours to be very beautiful.

02:59.960 --> 03:03.260
So you can see that the body has beautiful website.

03:03.260 --> 03:07.670
And that is what I put inside this body dot HTML and it's printed out.

03:07.700 --> 03:09.410
Now you can also put in the footer.

03:09.440 --> 03:11.150
I'll go ahead and paste this right in here.

03:11.180 --> 03:13.970
I'll go ahead and change this to HTML.

03:14.540 --> 03:18.140
And let's go ahead and save this and refresh.

03:18.140 --> 03:20.780
And you can see all rights reserved.

03:21.530 --> 03:26.300
In that way I was able to actually build a full website.

03:26.300 --> 03:34.460
And you can see I have my header, I have my body, I have my footer and they are really amazing, so

03:34.460 --> 03:39.080
I can be able to actually go on the header and do whatever I want to do right in here.

03:39.080 --> 03:42.710
And for the body, I can actually go right in here and do whatever I want to do.

03:42.710 --> 03:46.550
And for the footer, I can actually do whatever I want to do.

03:46.550 --> 03:54.140
So I created all these in the same folder where I have cited that PHP, and it was able to actually

03:54.140 --> 03:59.420
look for the file within the folder and be able to put whatever that is in there.

03:59.420 --> 04:01.910
So what do I have in there to render that for you?

04:01.910 --> 04:04.130
And that is why we have this beautiful website.

04:04.130 --> 04:06.320
Wow, this is a beautiful website.

04:06.320 --> 04:07.400
I literally love it.

04:08.720 --> 04:09.050
All right.

04:09.080 --> 04:14.390
So go ahead and put it down, take it out and practice with it so you can be able to try as much as

04:14.390 --> 04:17.780
possible to actually do more on this.

04:17.780 --> 04:23.930
In that way you can actually organize your website files and for now, all you need, you go ahead and

04:23.930 --> 04:29.300
look for the file and be able to modify that or manage it the way you want.

04:29.300 --> 04:31.610
And that is going to be all for now.

04:31.610 --> 04:33.800
So quiet practice.

04:34.220 --> 04:38.600
If you have any questions on this, please go ahead and use the question and answer section.

04:38.600 --> 04:41.210
And I'm going to get back to you as soon as possible.

04:41.240 --> 04:42.140
Thank you so much.

04:42.140 --> 04:45.200
And I'm going to see you in the next video lecture.
