Archive for Programming

PHP Guide for AdSense Publishers

Yesterday I went public with The HDTV Shoppe as an example of how to integrate AdSense with embedded content that is normally unavailable to the AdSense crawler. Today I’d like to talk about a related topic, how AdSense publishers can use PHP to their advantage to simplify website creation.

PHP is a programming language, but don’t let that scare you if you’re not technically inclined. The truth is, you don’t have to know much to take advantage of some basic PHP features, features that can be extremely useful in your website development. We’re limiting ourselves to “plain” websites here, but if you develop a familiarity with PHP you’ll find that it becomes a lot easier to customize WordPress WordPress blog themes and similar things.

How PHP Works

PHP is what’s known as “server-side scripting”. In other words, you mix PHP commands with the HTML tags of a page and when the web server is asked for the web page it first runs the PHP commands and then returns the processed page — not the actual page that’s sitting up on the web server. In other words, if you had this page sitting on your web server:

Read the rest of this entry »

Comments

How strict is your dynamic language?

Considering the “big four” dynamic, procedural languages; Perl, Python, PHP and Ruby, to an extent they’re much of a muchness, offering only small variations on the same theme (ignoring PHP’s lack of support for functional-style programming). But sometimes little things make a big difference, and perhaps most of all when your code is given input to handle which it wasn’t designed for. Knocked up a simple example to compare them in this area…

You’ve got a function which takes a hash value (an associative array) and does something with it’s contents—fairly typical logic for a database-driven application, where rows are common currency. For sake of simple example, let’s say your input is a list of names, each name broken into a hash with the keys “first” and “given”. The question is how will your function cope when the hash doesn’t have quite the structure you’re expecting (like the first name is missing), given a fairly “default” use of the language—no non-standard functionality to make the language stricter…

Perl

Tackling Perl first, here’s a working example…

Read the rest of this entry »

Comments

Evaluating PHP Applications

Following on from here, perhaps the two most common questions I’ve seen people ask, when it comes to evaluating PHP applications are;

  • Does it loook good?
  • Is it easy to install?

Now not everyone is a programmer or a system administrator—”normal human beings” rank these highly because they relate directly to the two most pressing problems they’re facing: they want a site which is visually attractive and, with limited technical expertise, installation can be a significant hurdle to overcome.

But when it comes to security or maintenance, those requirements rank pretty low down. So here’s some different things to think about, following on from this talk (PDF) on page 19, which I’d argue rank much higher when evaluating a project you plan to use (further suggestions appreciated).

Note that in an ideal world you’d have time and expertise on hand to do a full code review but in reality that’s not going to happen so what I’m suggesting here is meant as a reasonable compromise to help you build up a “ballpark” feeling for an application without making a huge effort.

Read the rest of this entry »

Comments

More PHP frameworks

Yes I know—with the framework in progress, we don’t need no more stinkin’ frameworks. Except there’s a couple I’ve seen recently which are noteworthy. I haven’t delved into the source code in any depth—exploring framework code bases has become as much fun as watching paint dry, but there are some interesting ideas here, if you’re looking to new angles on the problem.

First up is Tonic by Paul James which labels itself as “A RESTful Web App Development Framework”. It’s interesting because the API of the controllers you write is much like web.py which I covered before here (and tonic actually came first). Some interesting ideas—and it’s one of very few paying attention to HTTP. You’ll need to pull it out of CVS BTW (no download at this time).

Second in todays framework fiesta is Code Igniter (thanks to Mark Barton for the tip off)—this is from the same people that put together pMachine hence think it’s noteworthy. It’s very Rails-esque from superficial trawling but it’s appealing to the KISS point of view, plus there seems to be a cunning approach to URL mapping in there.

Read the rest of this entry »

Comments

Pages (3) : [1]2 3 »