Thursday, July 21, 2016

First Page

I am still extremely unhappy with the PHP Object Model. But I simply have to move my sites to a new server or perish.

Anyway, I just created the first official page for the new design. I decided to start with something simple; So, I created the About page . Each site in the project has an about page with a blob of text about the project. I store the blob in a SQL table.

As promises I am open sourcing the code. The code for this page is four lines long. The page simply calls the framework and says: I want to print a page with this data.

Here is the code for the About Page.

Okay, I could have reduced the size of the page to three lines of code.

PS: I am still working on the CSS and overall page layout. I will finish the work on the layout after I put up several pages with more complex content.

PPS: Okay, Okay. I removed the fourth line of code. The whole point of this project is that if one has a decent framework, then thee pages themselves will be short and fast.

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.