PHP Tools - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

PHP Tools

Description:

Dreamweaver, Ultradev (with PHAkt 1.5), or MX (optionally with PHAkt) ... Use bgcolor=' ?=$color? ' instead of bgcolor= ?=$color? Required elements ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 11
Provided by: jqjoh
Category:
Tags: php | bgcolor | tools

less

Transcript and Presenter's Notes

Title: PHP Tools


1
PHP Tools
  • JQ Johnson, Academic Education Coordinator
  • University of Oregon Libraries
  • 2 December 2002

2
Editing PHP code
  • Text editors, e.g. BBedit (Mac), Notepad (PC), vi
    (Linux), emacs
  • HomeSite
  • Dreamweaver, Ultradev (with PHAkt 1.5), or MX
    (optionally with PHAkt)
  • PHP-specific editing environments
  • Maguma Studio (95), Lite (freeware)
  • Zend Studio (195)
  • NuSphere PHPed (299)

3
Exercise
  • There is a copy of a short PHP program in your My
    Documents directory, called oops.php. Open it in
    Dreamweaver
  • Modify the PHP code so that instead of using
    HTTP_SERVER_VARS it uses the more modern (PHP
    4.1) _SERVER
  • Modify the HTML code to add a RESET button on the
    form

4
PHP is embedded in HTML Validation
  • Always validate your PHP output
    http//validator.w3.org(but note you need to
    test multiple code paths)
  • Validate your HTMLPHP source? Consider
  • lth1gtHilt?php echo empty(user)?"lt/h1gt""userlt/h
    1gt"?gt
  • I restrict my PHP code so that the source will
    also validate.

5
Exercise
  • Visit a .php page that youve written, and view
    its output using view source
  • Now validate it at http//validator.w3.org
  • Download your .php source to your hard disk, and
    validate that as well.
  • Time permitting fix bugs youve found.

6
PHP and HTML Tidy
  • Tidy recognizes (and skips) lt?php?gt and ASP
    ltgt. lt??gt short tags are sometimes confused
    with XML
  • Tidy does not reformat any html generated within
    php tags
  • Tidy can get confused by PHP scripts that
    generate
  • Portions of containers
  • Empty attributes values. Use bgcolor"lt?color?gt
    " instead of bgcolorlt?color?gt
  • Required elements

7
A code fragment that mostly works
  • lt?phpq"SELECT name,age FROM people WHERE
    class'class'"datamysql_query(q) or
    die(Oops! \"q\" . mysql_error())?gtlttablegt
    lttrgt ltthgtNamelt/thgt ltthgtAgelt/thgt
    lt/trgtlt?phpwhile (row mysql_fetch_row(data))
    ?gt lttr bgcolor"lt?(wh!wh)?'FFFFFF"''CCC
    CCC'?gt"gt lttdgtlt?row'name'?gtlt/tdgt
    lttdgtlt?row'age'?gtlt/tdgt lt/trgtlt?php
    mysql_free_result(data)?gtlt/tablegt

8
Exercise
  • Run HTML Tidy, and reformat the code from the PHP
    file you downloaded in the previous exercise

9
Other important tools
  • Run PHP from command linedarkwing php s
    foo.php gtfoo.htm (also a for interactive, -l
    for syntax check)
  • PHP 3 had a built-in debugger (r.i.p.)
  • For any mysql development phpMyAdmin

10
References
  • PHP http//www.php.net
  • Commercial editing environments
  • http//www.macromedia.com/desdev/topics/php.html
  • http//www.zend.com
  • http//www.maguma.com
  • http//www.nusphere.com
  • http//www.interakt.ro
  • W3C validator http//validator.w3.org
  • HTML Tidy http//www.w3.org/People/Raggett/tidy/
  • phpMyAdmin http//www.phpmyadmin.net
Write a Comment
User Comments (0)
About PowerShow.com