Skip to Content
WordPress® All-in-One For Dummies®
book

WordPress® All-in-One For Dummies®

by Lisa Sabin-Wilson, Cory Miller, Kevin Palmer, Andrea Rennick, Michael Torbert
April 2011
Beginner to intermediate content levelBeginner to intermediate
908 pages
22h 37m
English
For Dummies
Content preview from WordPress® All-in-One For Dummies®

Trying Out a Little PHP

To test some PHP code, follow these steps to create a simple HTML Web page with an embedded PHP function:

  1. Open a new, blank file in your default text editor — Notepad (Windows) or TextMate (Mac) — type <html>, and then press Enter.

    The <html> tag tells the Web browser that this is an HTML document and should be read as a Web page.

  2. Type <head> and then press Enter.

    The <head> HTML tag contains elements that tell the Web browser about the document; this information is read by the browser but hidden from the Web page visitor.

  3. Type <title>This is a Simple PHP Page</title> and then press Enter.

    The <title> HTML tag tells the browser to display the text between two tags as the title of the document in the browser title bar. (Note: All HTML tags need to be opened and then closed, just like PHP tags that we describe in the preceding section. In this case the <title> tag opens the command, and the </title> tag closes it and tells the Web browser that you're finished dealing with the title).

  4. Type </head> to close the <head> tag from Step 2 and then press Enter.
  5. Type <body> to define the body of the Web page and then press Enter.

    Anything that appears after this tag displays in the Web browser window.

  6. Type <?php to tell the Web browser to start a PHP function and then press Enter.

    See the preceding section on starting and stopping PHP functions.

  7. Type echo ‘<p>Testing my new PHP function</p>’; and then press Enter.

    This is the function that you want PHP to execute ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

WordPress® 24-Hour Trainer

WordPress® 24-Hour Trainer

George Plumley
Gaming Hacks

Gaming Hacks

Simon Carless

Publisher Resources

ISBN: 9780470877012Purchase book