Information Technology Reference
In-Depth Information
IV
WordPress themes basically don't exist without PHP's include function. It's used to import the
contents of another file. This allows you to include other PHP scripts or even other HTML files into
your scripts and use PHP to template your website:
<html>
<h1>Welcome!</h1>
<?php include “menu.html”; ?>
<img src=”img/me.jpg” alt=”picture of me” />
<p>Welcome to my website. Here you'll learn all sorts of neat stuff about
me. Here are some of the things that are going on in my life right now:</p>
<?php include “events.html”; ?>
<p>Thanks for stopping by!</p>
<hr />
<?php include “footer.html”; ?>
</html>
This standard web page incorporates three PHP scripts that use the include function to pull in three
separate files, menu.html, events.html, and footer.html. Where at one time these files might display
as separate frames with different navigation schemes, PHP allows you to view these elements
seamlessly on a single page. A separate style sheet would determine the exact placement of each
included element.
Forms
Maybe it's a small exaggeration, but you could think of WordPress as just a big collection of special-
ized web forms. One has a really big edit box to fill with your thoughts, also known as blog post-
ings. Other forms let you categorize and tag your posts in a free-form manner, link to your favorite
sites, and give you a way (RSS) to let your visitors become regular readers. Then, there are the set-
tings forms that let you define what your site looks like and what sort of functionality it should
have through plug-ins and widgets. Did we mention the forms that let your readers comment on
your posts?
PHP makes it pretty easy to create forms with a small amount of programming and a bit of HTML.
You'll see that when we look under the hood of a plug-in in “Examining an Existing Plug-in” later
in the chapter.
PHP and MySQL
note
There is no shortage of topics to help
you learn PHP and MySQL together.
Julie C. Meloni's PHP, MySQL and
Apache All in One will get you off to a
great start.
Before you even installed WordPress, MySQL already knew it
was coming. This is how closely WordPress, PHP, and MySQL
work together.
Every bit of content in your blog—posts, sidebars, style
sheets, comments, graphics, Dashboard, and all the rest—is
stored in the MySQL database you set up during your instal-
lation (or that WordPress.com set up for you when you launched your hosted blog). What happens
when your site has a visitor? In a matter of seconds, all this goes on, as shown in Figure 15.3:
Search WWH ::




Custom Search