WEBVTT

00:00.320 --> 00:03.260
I will call you back again to another video lecture in PHP.

00:03.290 --> 00:10.190
And in this video lecture, I'll go ahead and teach you how to include PHP file in your PHP program.

00:17.060 --> 00:17.390
Okay.

00:17.420 --> 00:21.320
So we're going to include another PHP file into our PHP program.

00:21.320 --> 00:23.390
And I'm going to teach you how to do that.

00:23.390 --> 00:30.620
So in this case we are working on a PHP five course site dot PHP and want to create another PHP file

00:30.650 --> 00:32.300
called blog dot PHP.

00:32.300 --> 00:36.020
So what to include a blog page on our website.

00:36.020 --> 00:37.190
So how do we do that?

00:37.220 --> 00:39.320
Go over to a folder right in here.

00:39.350 --> 00:41.960
Right click on this and click on a new file.

00:41.960 --> 00:47.570
So let me go ahead and call out to be my blog dot PHP.

00:47.810 --> 00:48.290
All right.

00:48.290 --> 00:49.340
Go ahead and hit enter.

00:49.340 --> 00:52.220
And I have my blog dot PHP right in here.

00:52.550 --> 00:54.830
So inside is my blog of PHP.

00:54.860 --> 00:56.960
I'm going to have a blog title.

00:56.990 --> 00:59.270
I'm going to have a blog auto.

00:59.300 --> 01:03.080
I'm going to have a comment so people can connect to my blog.

01:03.080 --> 01:13.160
And let's go ahead and say the block title is going to be like H2 and go ahead and close the H2.

01:13.790 --> 01:21.440
So inside here I'm going to include a PHP file that's going to pop out the title of this blog.

01:21.470 --> 01:25.850
But that's also the name of the title will be Dot right in here.

01:25.880 --> 01:29.390
What I'm going to create a variable of that title right in here.

01:29.420 --> 01:32.570
So let's go ahead and show you how to do that.

01:32.570 --> 01:40.220
So what I'm going to do is I'll go ahead and include PHP, so P, PHP and go ahead and close that.

01:40.220 --> 01:42.080
So what are we going to put in right here.

01:42.080 --> 01:51.350
And I'm going to say PHP equal the let me say this is my blog title.

01:51.350 --> 01:52.490
So this is the variable.

01:52.490 --> 01:57.560
But this variable has not been declared because I'm going to declare this variable right in here.

01:57.590 --> 01:59.870
What I'll echo the variable name.

01:59.870 --> 02:04.670
So this is going to be popped out okay from my blog page.

02:04.670 --> 02:06.860
So everything will be shown on my blog page.

02:06.860 --> 02:11.820
But I'm going to declare that variable and give it a name right inside the site dot PHP.

02:11.910 --> 02:14.790
But whatever I'm going to do on that blog will be done right in here.

02:14.820 --> 02:17.940
Now, I've done this and now go ahead and see.

02:17.940 --> 02:20.220
The next one is the blog portal.

02:20.250 --> 02:27.060
So to score and change this to maybe like a hash three so that the heading count becomes smaller and

02:27.060 --> 02:28.410
go ahead and close that.

02:28.440 --> 02:38.250
Now I'm going to I'm going to go ahead and put in p h p and go ahead and close that as well.

02:39.030 --> 02:41.160
Now I went ahead and echoed.

02:43.920 --> 02:47.610
Let me say blog author.

02:49.890 --> 02:51.810
So this is the author of the blog.

02:51.810 --> 02:54.240
And then for the comment section is going to be a paragraph.

02:54.240 --> 02:56.160
And we're going to say paragraph.

02:56.160 --> 03:01.980
And go ahead and put in PHP and go ahead and close this as well.

03:02.010 --> 03:04.410
So I'm going to close my paragraph tag.

03:04.410 --> 03:07.170
And from here I'll go ahead and echo this.

03:07.200 --> 03:10.260
I'm going to say this is echo.

03:10.470 --> 03:15.120
And then this is a blog comment.

03:15.180 --> 03:15.720
All right.

03:15.720 --> 03:16.920
So I have the blog title.

03:16.950 --> 03:18.420
I have the blog auto.

03:18.450 --> 03:22.590
I have the blog comment and it is ready right now.

03:22.590 --> 03:29.340
But what I need to do is I have to go and declare all these the title, the author and the comments

03:29.340 --> 03:30.120
right in here.

03:30.120 --> 03:36.720
So I'm going to go to my PHP right in here, and I walk ahead and start the declaration on this guy

03:36.720 --> 03:39.120
and say, so let me go back right in here.

03:39.120 --> 03:45.900
And for any one of them I just copy this, okay, I'll just copy this and then I'll go ahead and paste

03:45.900 --> 03:46.140
that.

03:46.170 --> 03:50.850
And I'm going to set the blog title is going to be PHP blog.

03:54.120 --> 03:55.320
PHP blog or.

03:57.540 --> 03:57.930
Okay.

03:57.930 --> 03:59.940
That is the key is any name you give.

03:59.970 --> 04:00.450
Okay.

04:00.480 --> 04:02.850
You will not find anything right in here.

04:02.880 --> 04:05.910
We just want to learn about including the PHP file.

04:05.940 --> 04:10.470
Now come here and go to the auto and lady auto.

04:10.470 --> 04:14.760
Be equal to George Steve and put semicolon at the end.

04:14.790 --> 04:16.510
And the next one is the comments.

04:16.510 --> 04:20.350
So the PSP comment, the blog comments.

04:20.350 --> 04:23.440
So go ahead and press that and let the blog commence.

04:23.440 --> 04:25.480
So this is going to be equal sign.

04:25.480 --> 04:32.500
So because you need to declare that and then go ahead and say beautiful blog.

04:35.560 --> 04:38.890
Beautiful blog beach.

04:39.430 --> 04:39.790
All right.

04:39.790 --> 04:43.630
So this is a beautiful blog page because you're going to build an awesome blog page right in here.

04:43.720 --> 04:45.220
So go ahead and save this.

04:45.220 --> 04:51.700
So the next thing we need to do is to go ahead and include this PHP file called my blog dot PHP.

04:51.730 --> 04:54.640
We need to include that so we can be able to print that out.

04:54.640 --> 05:01.390
So if I go ahead now all I need to do is go ahead and use the include.

05:01.390 --> 05:02.440
And then I'll go.

05:02.440 --> 05:08.710
I'll include my my blog dot p h p.

05:08.920 --> 05:15.520
And once you do that, place semicolon at end and go ahead and save this so you can see I've saved this.

05:15.520 --> 05:18.070
Now let's go over here refresh and check it out.

05:18.130 --> 05:21.640
So I have PHP block, which is this.

05:21.670 --> 05:25.570
I have a block judge Steve, which is this.

05:25.600 --> 05:28.000
I have beautiful block which is this.

05:28.000 --> 05:35.770
And remember, that's everything I'm doing is right from here, because I cannot actually go right in

05:35.770 --> 05:43.360
here and modify this to be maybe this is hash one or change this to hash one or save this and let's

05:43.360 --> 05:44.020
refresh.

05:44.020 --> 05:45.820
You can see it's now big.

05:46.240 --> 05:49.030
Okay I can change this to H6.

05:49.780 --> 05:55.570
I can change maybe the block order to h6, I save this, let's refresh.

05:55.600 --> 06:02.560
You can see that Steve is now smaller and the paragraph is to the paragraph, the beautiful block page.

06:02.560 --> 06:07.120
So now it is easier for me to include this.

06:07.210 --> 06:17.500
My block dot php right inside the sites dot PHP is in the include, so you only include.

06:17.500 --> 06:22.180
I was able to actually do that and now I can also create a function right in here.

06:22.180 --> 06:25.370
And I'm going to call that function into the PHP.

06:25.460 --> 06:27.020
Let me go ahead and teach you how to do that.

06:27.020 --> 06:28.580
So you want to create a function.

06:28.580 --> 06:30.950
Go ahead and create a PHP file.

06:32.060 --> 06:34.370
So go ahead and close this.

06:34.370 --> 06:40.400
And right inside here this car head and create a function.

06:40.400 --> 06:43.130
So I'm going to give this a function name.

06:43.400 --> 06:44.720
Let's go ahead and say.

06:47.180 --> 06:48.230
Function.

06:48.260 --> 06:52.070
And let the name of the function be hello world.

06:52.190 --> 06:59.660
And world hello world is going to do is just going to say um welcome to PHP.

06:59.900 --> 07:04.280
So welcome to PHP or hello welcome to PHP.

07:04.520 --> 07:05.120
All right.

07:05.120 --> 07:08.960
So now I'm going to put in name.

07:10.970 --> 07:14.360
So I'm going to put this a name when I'm passing the name right in there.

07:14.360 --> 07:15.710
So it's going to call your name.

07:15.710 --> 07:17.540
And you're going to say Jorge welcome to PHP.

07:17.570 --> 07:18.680
That's what I'm going to do.

07:18.680 --> 07:25.730
And uh, let's go ahead and uh, call this, I'm gonna say.

07:25.730 --> 07:29.150
See, I'm going to pass a name.

07:29.150 --> 07:33.350
So you're going to call your name first and I'll tell you to work on to FB.

07:35.180 --> 07:35.990
I see.

07:40.250 --> 07:41.510
Welcome.

07:44.060 --> 07:45.470
Welcome to FB.

07:45.950 --> 07:47.990
I might go ahead and put a semicolon at the end.

07:47.990 --> 07:52.100
And now I'm going to go over here.

07:52.100 --> 07:59.690
So anytime you want to call a function right in here it shows that you have already included this.

07:59.720 --> 08:05.240
It was actually include this because if this goes above this place you're going to have an error.

08:05.240 --> 08:07.760
So I'm going below and not above.

08:07.760 --> 08:13.070
But if I want to declare your variables then I have to always be above the include function.

08:13.070 --> 08:20.570
Now under the include I'm going to call the function name which the function name is hello world.

08:20.600 --> 08:21.230
All right.

08:21.230 --> 08:22.910
So go ahead and copy that.

08:22.910 --> 08:26.000
And I'm going to say hello world.

08:26.000 --> 08:29.450
And then I'm going to pass in the name I want maybe judge.

08:29.460 --> 08:31.050
work onto hello world.

08:31.230 --> 08:34.590
So please, semicolon at the end of this and let's save this.

08:34.590 --> 08:36.960
Now let's go ahead and refresh this and check it out.

08:36.990 --> 08:37.530
Judge.

08:37.530 --> 08:38.940
Welcome to Hello World.

08:39.450 --> 08:39.840
Okay.

08:39.840 --> 08:42.960
So I can put semicolon at the end okay a comma.

08:42.960 --> 08:45.840
And then it says Jorge welcome to PHP.

08:45.960 --> 08:49.980
So I can see I was able to include a function like code right in here.

08:49.980 --> 08:54.780
And now I was able to call the function inside sites dot PHP.

08:54.780 --> 08:56.940
So you can actually do that.

08:56.970 --> 09:02.820
Use one page to do some things, and then come over to your main page and call the functions.

09:02.820 --> 09:04.530
And this kind of work out fine.

09:04.530 --> 09:05.610
And so beautiful.

09:05.610 --> 09:14.490
This is the way you can actually include, uh, a PHP file into another PHP and work on your project.

09:14.970 --> 09:16.680
So I hope that is beautiful.

09:16.710 --> 09:22.560
Kind of play around with it, check it out, try it more as possible to enhance this and do more.

09:22.560 --> 09:24.150
And lots of things under here.

09:24.150 --> 09:27.870
So if you have any questions, please go ahead and use the question and answer section.

09:27.870 --> 09:30.240
And I'm going to get back to you as soon as possible.

09:30.270 --> 09:31.200
Thank you so much.

09:31.200 --> 09:34.020
And I'm going to see you in the next video lecture.
