Monday, July 18, 2016

Recoding Site

I need to get myself in gear and start programming again.

The problem I face is that PHP deprecated the mysql_query() function and wants people to use a hideous piece of code called PDO.

I have yet to find a single implementation of PDO that does not turn my stomach. I am to the point of giving up on PHP altogether and just writing everything in C. Let's face it, the only reason I used PHP was because my webhost wouldn't let me write and compile code on the server.

PHP is a programming language that is commonly used to create HTML for display on a browser. Most PHP programmers don't care about the quality of the HTML, but I want the HTML produced by my programs to be well formed and well formatted.

PHP does not allow programmers to override the echo command; So I wrote a function called htag() which keeps track of the indentation level of the HTML code.

As for PDO, I created a function called dbConn() to encapsulate the PDO Object. I make the calls to the database with functions called sqlValue(), sqlRow() and sqlExec().

Being a good netizen, I will open source the PHP for the Community Color project on the site The program includes a schema viewer which lets you see the create statements for the tables used by the site and a code viewer which lets you look at the PHP for select files in the program.

The first piece of code I present is the code viewer. This pieced of code was just a brute force program I wrote to show formatted code. It is not well designed.

The cool thing about these viewers is that they pull and display code from the live web site.

No comments: