Skip to Content
PHP Hacks
book

PHP Hacks

by Jack D. Herrington
December 2005
Intermediate to advanced
468 pages
9h 12m
English
O'Reilly Media, Inc.
Content preview from PHP Hacks

Chapter 3. DHTML

Hacks 11–26: Introduction

This chapter covers using Dynamic HTML (DHTML) in your web applications. DHTML is a term used to define the powerful combination of HTML, CSS, and JavaScript. The hacks in this chapter use DHTML to create all types of interactive interfaces for your web applications, from spreadsheets to dynamic graphs, pop ups, slideshows, vector graphics, and more.

Put an Interactive Spreadsheet on Your Page

Use the ActiveWidgets spreadsheet library to put an interactive JavaScript data control on your page.

Let’s face it: some data—particularly financial and statistical data—just looks better when it’s presented as a spreadsheet. Unfortunately, HTML does a poor job of giving you an interactive spreadsheet-style feel, especially when it comes to scrolling around, sorting, or any of the truly interactive user experience elements of a spreadsheet.

This hack uses the ActiveWidgets (http://activewidgets.com/) grid control to create a spreadsheet-style interface on a web page.

The Code

Save the code in Example 3-1 as index.php.

Example 3-1. A script that provides state-specific data in a spreadsheet format
<?php $states = array( array( "Alabama",4447100,1963711,52419.02,1675.01,50744,87.6,38.7 ), array( "Alaska",626932,260978,663267.26,91316,571951.26,1.1,0.5 ), array( "Arizona",5130632,2189189,113998.3,363.73,113634.57,45.2,19.3 ), array( "Arkansas",2673400,1173043,53178.62,1110.45,52068.17,51.3,22.5 ), array( "California",33871648,12214549,163695.57,7736.23,155959.34,217.2,78.3 ...
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

PHP 5 Unleashed

PHP 5 Unleashed

John Coggeshall
PHP Master

PHP Master

Davey Shafik, Lorna Mitchell, Matthew Turland
Pro PHP Programming

Pro PHP Programming

Peter MacIntyre, Brian Danchilla, Mladen Gogala

Publisher Resources

ISBN: 0596101392Errata Page