From the course: Learning PHP
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Build a simple templating system for the provided markup - PHP Tutorial
From the course: Learning PHP
Solution: Build a simple templating system for the provided markup
(upbeat music) - [Instructor] All right, let's take a look at the solution for our website template challenge. Here's the resulting HTML. And if we go back to our directory, you can see that we have a single index.PHP file that we want to convert into templates. So I'm going to go ahead and create two directories here. And I should say right off the bat that you probably did this differently. There are a lot of different ways that you can solve this problem And this is just one of the many solutions. So I'm going to create a folder called Inc and a folder called templates. I'm doing this because I like to keep my projects organized in this way, where Inc is where straight up PHP files go. Things like variables or functions and templates are where the different HTML sections go. So, again, right off the bat, I see a set of variables here. I'm going to cut them out of this file and I'm going to create a new file inside Inc…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
Organizing your code2m 45s
-
(Locked)
Using include and require4m 43s
-
(Locked)
include_once and require_once2m 46s
-
(Locked)
Namespacing3m 29s
-
(Locked)
Challenge: Build a simple templating system for the provided markup32s
-
(Locked)
Solution: Build a simple templating system for the provided markup7m 18s
-
-
-
-
-