Level 2 scripting

I got hired here in Thailand based on my Flash and Actionscript knowledge but I knew that the job would mostly be about coding PHP. During the interview they reviewed my Flash work but didn’t bother calling me on my PHP exaggerations, phew.

Wise from my earlier mishap I realized I would have to step up if I was to be on this job for any amount of time so I dug into the PHP manual with a vengeance (as a PHP programmer that manual is your single most important document, everyone has/should have a link to the CHM version on their taskbar).

At this point I knew I had to do some serious including to be able to complete my first project which was a dating site. Simply creating documents with functions in them didn’t feel right though. There would be no way for me, or more importantly any collaborator, to know which document any given function belonged to by just looking at the invoking code. But as I was browsing through the class section of the manual I noticed that you could basically turn classes into c style namespaces by declaring their methods as static. Eureka! That was exactly what I wanted. I quickly created some general static classes, one for common database related tasks, one for advanced string manipulation and one for more advanced array stuff.

Another important factor is that the company dictated that we had to use Smarty to separate view and logic, it didn’t take long for me to realize that Smarty was a really good thing. And that is how that project was completed, with static classes in order to chop up the code in meaningful units and Smarty to separate PHP and markup.