hellorobot.org

Graffiti, 
St. Petersburg, July 2006

PHPincludes 9 posts.

Parse Error: syntax error, unexpected $end

“Parse Error: syntax error, unexpected $end” is one of those less-than-transparent error messages. What exactly does it mean?

Usually this error is trying to tell you that a curly brace was opened but never closed: an opening if (condition) { with no closing }; or, as another example, an foreach($var as $subVar): with no endforeach;.

Changes Coming in PHP 6

Namespaces are being introduced, as is better core support for SOAP and XML. Some things are being deprecated that ought to be deprecated – and likely will have no affect on up-to-date websites and servers because the scripts and server settings will already avoid these things: safe_mode, register_globals, the old long predefined variable arrays (like $HTTP_GET_VARS), the ASP-like open/close script tags (<% and %>).

Twitter Abandoning RoR?

If I had more time – or didn’t need sleep or food perhaps – I’d be interested in learning Ruby and Ruby on Rails, if only to see what all the fuss is about.

As I’ve begun experimenting more and more with PHP frameworks, one of my big worries would be that the frameworks enable quick development but only as a means of hedging bets: the site’s up and running fast but the problems are reserved for later: if a site succeeds, if it’s traffic increases immensely, then the framework could become the source, instead of the solution, to scalability problems. And how do you fix a problem that’s part of the system’s core? Re-do the core?

Rumors are that’s what’s happening at Twitter.

Continued Confusion in the Zend DB Class

I’m still questioning how I should best use the Zend Framework’s database model classes.

The data structure of the current application I’m building is not very complicated: there are 8 tables of between 2 and 11 fields each, and some of the tables are simple parent tables that define user types or status types.

To simplify, three of the tables that do the heaviest lifting do so in a hierarchy like a tree: a user table has a one-to-many relationship with a submissions table, which, in turn, has a one-to-many relationship with a recommendations table.

I extended the Zend_Db_Table_Abstract to model each table (as well described in the documentation). That was easy; I like that.

A Better Understanding of the MVC Pattern

“MVC helps to reduce the complexity in architectural design, and to increase flexibility and reuse.” In a web application, the model is the most static element across time; the data behind a website may change but the shape of the data, the organization of the data, if well constructed, is fairly stable. The physical appearance and degree of interactivity of the site’s actual web pages – this will change the most: adapting to new delivery formats (iPhone, text readers, etc.) as well as adjusting regularly to design trends and new technologies (consider the way AJAX changed the possibilities of front-end development).

Creating a consistent, encapsulated layer around the data, one that’s easy to maintain, is good. It’s extending the lifetime of that data structure, creating the ability to apply it to multiple view types and demands. It makes sense then that the model is blind to the view. And if the controller were always the intermediary between the two, the controller would be too tightly coupled to each: any real change to the view would require one to the controller as well. That’s where my first interpretation of MVC went awry. What was the point of having three components? That’s what didn’t make sense. The controller was basically an extension of the view.

The Model in Zend’s MVC

I’ve begun building an application using the Zend Framework. I’ve incorporated a basic MVC structure, mapping some classes to the database tables. There’s a log-in form that I’ve created that authenticates via the database, and it works. I have some basic views created. Mostly it’s going well.

But the trouble is this: I don’t really know what to do with the model end of the framework.

Choosing a PHP Framework

The more I read up on the different frameworks the more reasons I find that people prefer one over another: ease of development; speed and scalability; plug-in architecture and add-on features; quality of documentation… All of it matters, but some, I think, much less: yes, it’s troublesome if a framework has poor documentation and is difficult to development in, but I think the length and slope of the learning curve is especially significant in conjunction with the results of mastery: a violin, for example, is one of the hardest musical instruments to learn, but once mastered, its potential far outstrips almost every other instrument.

Assuming a baseline of functionality – an object-relational mapping to the database, a reliable MVC structure, an authentication class, et cetera – and assuming a baseline of accessibility, where the documentation is detailed at least enough to allow mastery of a framework within a reasonable period of study, I think that frameworks should be evaluated on their maximum potential. A framework should be extensible, transparent, and professional.

Bug in wp_list_bookmarks?

When I first began building out hellorobot.org, modifying the Grid Focus theme, I wanted to be able to feature some of an ongoing list of links – say only the newest 5. Seemed easy.

WordPress has a built-in template function for displaying links, wp_list_bookmarks(), with a decent list of options that can be passed as a URL query string. One of those options is ‘orderby,’ which natch specifies the order in which the links should be displayed. I wanted it to be ordered by date so, as described in the WP documentation, I entered ‘orderby=updated&order=desc.’

It didn’t work.

Customizing the Grid Focus WordPress Theme

I am not a designer. For me, creating a good-looking site design is a long and tedious task of trial and error. So one of the things I’m learning to love about building a site in an open-source CMS platform like WordPress is the number of free designs available. And some of them are even good!

Check out this list from Smashing Magazine. It’s where I found Derek Punsalan’s Grid Focus, which I loved for its clean and neutral look. I like the hyper-organization of it.

What follows is an ongoing documentation of the changes, customizations, updates that I am making to hellorobot.org’s Grid Focus install. Hopefully, some of these changes are for the better.

Hellorobot.org is the development hub, blog, & portfolio site of Brian Leary. Who is Brian Leary?