I'm having fun and breaking down barriers with PHP

I never thought I’d program a Web page.

I’ve done a little programming, but on the Web I have been happy to either create static pages or to use a content management system. My Web programming has been limited to using includes to modularize my pages and tossing CMS macros onto my pages.

But since I’ve started building Coastsider [password required for the next week or so], I’ve started using PHP. I started using it against my will, just to get some of the “templates” that came with my classified software to look like the rest of the site. Then, I started using it to create forms for my users.

Yesterday, I created a page that interfaced to the Terraserver’s satellite photo database, including panning and zooming. It’s empowering to be able to build software into your web pages. It’s barrier-shattering to be able to mix code with HTML to do simple tasks and to interface to your content management system. The architecture of PHP encourages experimentation.

No more than a small number of individual Web site publishers will ever do much coding. On the other hand, I now think that increasingly powerful content management systems will encourage programming, rather than make it unnecessary.

4 thoughts on “I'm having fun and breaking down barriers with PHP

  1. Barrier shattering, maybe, unmaintainable, definately. PHP is indeed very powerful, but you’d be wise to split function from presentation every chance you get.
    For instance, everytime i need something out of a database i create two functions: one to get the data, one to format it for presentation. Its helpful too, in that if i need the data elsewhere i just need another function to format it differently.
    HTH, James

  2. I can’t argue with that. But in the pages I’m talking about the software is the content, and I do separate content from presentation as much as I possibly can.
    I’m building single-function self-contained pages where the php isn’t a lot more complex than HTML, and it’s just as maintainable (for good or ill). But it’s genuinely interactive. Without php, it would be impossible for me or a lot of other individuals to do this.
    I can’t address the suitability of php for large-scale programming, but I’m beginning to suspect that it can be done maintainably as well.

  3. Larger-scale PHP projects *can* be maintainable, but getting them to be maintainable is a pain — mostly for technical reasons such as the fact that PHP has only a single global namespace. For that reason, I’ve stopped using PHP completely — at home and at work.

  4. For working with PHP, I would recommend two projects:
    ADODB
    smarty
    ADODB makes sure that you are database independent. (sure you always use the same type of database until…)
    Smarty does seperation for you. Build a smarty template in the templates file and away you go.
    If you use a database well, I would recommend my version of phpcodegenie. With it, you expand it to a directory, make sure that you have smarty and adodb setup, ensure that you have configured your users name and password for a mysql database and then you can have it write code that uses the above and you just download it to your machine. (wget or curl does it for you)

Leave a Reply to hirsch Cancel reply

Your email address will not be published. Required fields are marked *