Information Technology Reference
In-Depth Information
IV
Learning PHP
Many people are put off by any kind of programming. However, millions of people who are
non-college graduates or liberal arts majors, who don't like math, who would never wear a pocket
protector or fix their eyeglasses with electrical tape, or who otherwise consider programming to be
something they do not do have learned the necessities to program in WordPress.
It's fine to get a book on PHP or WordPress programming, take a course, and/or find a supportive
and knowledgeable friend if you feel the need. However, you might be surprised how far you get
with the introduction and orientation given here and with existing WordPress plug-ins as grist for
your mill.
The coding might seem intimidating at first, but many who were initially frightened have learned
by example and experimentation, supported by the WordPress community. You won't break
WordPress—many more talented, and with far worse intentions, than you have tried and failed.
Don't be afraid to dive in.
The PHP Home Page at www.php.net defines PHP as “a widely used general-purpose scripting lan-
guage that is especially suited for Web development and can be embedded into HTML. Much of its
syntax is borrowed from C, Java, and Perl with a couple of unique PHP-specific features thrown in.”
It is open source, so anyone can contribute to its development, and works from the web server to
deliver pages. As you'll see later in the chapter, PHP often pulls data out of relational database
management systems such as MySQL and PostgreSQL to display web pages that look no different
from pages coded in standard HTML.
The core WordPress software is written in PHP. Themes consist of PHP templates and CSS styles.
Plug-ins can be written in PHP exclusively, or can include code from other languages (such as
JavaScript), but need to be able to hook into WordPress to provide the necessary functionality.
That is done using PHP as well.
Extending PHP
Although you really don't need to worry about it to work in WordPress, be aware that PHP has its
own plug-in library. As you get deeper into PHP, you'll want to check out the PHP Extension and
Application Repository (PEAR) at http://pear.php.net and the PHP Extension Community Library
(PECL) at http://pecl.php.net.
The PECL library is a set of modules that can link into the language's core. The new functions they
provide are then available as any of PHP's built-in functions.
PEAR is a collection of reusable, open source code for use in your PHP applications. The code is
organized as collections of files (or packages ) that act as wrappers, giving convenient access to
various PHP functions or extending PHP in some way.
Both PECL modules and PEAR packages can be installed using the php5-pear command-line utility.
Calling pear without any arguments displays a list of commands pear understands. The install
argument followed by the package or module name installs it; the uninstall argument similarly
uninstalls the component.
Search WWH ::




Custom Search