Locked lesson.
About this lesson
Understanding how Wordpress uses Templates and how we can do the same thing.
Exercise files
Download this lesson’s related exercise files.
Understanding The Templating Concept.docx59.3 KB Understanding The Templating Concept - Solution.docx
59.2 KB
Quick reference
Understanding the Templating Concept
Let's look at templating.
When to use
We've already touched on templating, let's dive in deaper.
Instructions
Templating is good for breaking apart different sections of a web page. It makes updating large website easy.
Hints & tips
- Templating makes updating large sites easy.
- 00:04 We've created our math flash card app and it's looking pretty good.
- 00:07 In this video I want to talk about something called templating.
- 00:10 And we've already sort of touched on this earlier when we talked about include and
- 00:15 require.
- 00:15 Those are the main tools we'll use for templating.
- 00:18 But, right now I just want to sort of talk about the concept of it,
- 00:21 what it's for, why we care, and what we're gonna do with it.
- 00:24 So, PHP is one of the most popular programming languages in the world and
- 00:29 it's not because it's particularly great,
- 00:31 but I think you've already found that it's pretty easy to use.
- 00:34 The reason why it's so popular is because of WordPress and
- 00:37 you've probably heard of WordPress.
- 00:39 WordPress is a content management software.
- 00:43 You can go to wordpress.org, not to be confused with wordpress.com,
- 00:48 the third party hosted blog site.
- 00:50 Wordpress.org is the actual WordPress itself.
- 00:53 You can download this for free.
- 00:55 You can install it on a web server, and run it in your own WordPress blog.
- 00:58 Well, WordPress was built with PHP.
- 01:01 It is completely and totally built with PHP.
- 01:05 And one of the reasons why it's so popular is all this templating.
- 01:08 It's just a WordPress blog is broken up into all the different templates with PHP,
- 01:14 and just makes it very, very easy to create a content management system.
- 01:18 Well, we're not going to be creating a whole content management system, but
- 01:21 the idea of templating,
- 01:22 the concept, I sort of want to talk about just a little bit.
- 01:25 And it's not that difficult to wrap your brains around and
- 01:28 it makes things much, much easier.
- 01:30 So what would we do if we wanted to template this thing out?
- 01:33 Well, we have these four pages right and they all sort of look the same.
- 01:37 They are the same sort of look to them, the same layout,
- 01:40 they have the same set of links at the top here.
- 01:43 They all have these numbers, they have the same form.
- 01:47 We don't have anything down here as a footer, but let's go ahead and create one.
- 01:50 Say if we wanted our index page,
- 01:53 let's just come back here real quick and create some line breaks.
- 01:59 Let's go copyright c and let's throw
- 02:04 in a date like we already know how to do.
- 02:13 All rights reserved.
- 02:15 Okay, so if we save this, come back here, and hit Reload,
- 02:18 we have this nice little copyright statement at the bottom here.
- 02:22 Well, what if we wanted that on all of these pages?
- 02:24 Well, we could just copy and paste that line of code.
- 02:26 But we might wanna change that later on.
- 02:29 Same thing with these links, we might wanna add an exponent or
- 02:33 a modulus flash card, or some other sort of flash card.
- 02:36 And instead of then fixing every single page, going back and
- 02:40 changing all the links on all the pages,
- 02:42 or changing the copyright notice on all of the pages, look at that.
- 02:46 Our date did not show up.
- 02:48 Must have done that wrong.
- 02:50 Forgot to echo.
- 02:53 There we go.
- 02:54 So anyway, as I was saying, it's a good idea to template these things out.
- 02:58 In the next video we're gonna kind of start to template this out.
- 03:01 Now, this is a very basic app.
- 03:02 There's not a whole lot of templating to do,
- 03:05 but it's a good idea to get in the habit of whenever you build an app,
- 03:08 whenever you create anything, think in your mind how you can template it out how
- 03:12 you can make it easier over all with the building process.
- 03:15 So, in the next video we will start templating this thing out.
Lesson notes are only available for subscribers.