repository posts

PHP Output Buffer Manager

With rebuilding my website with WordPress, I have made progress on the WordPress starter theme I’ve been working on. One thing I used for it was PHP’s output buffering to control output and allow me to define “blocks” of content, then render them at a later point in their proper location. To this end, I created some helper methods to manage this for me and allow easy creating of named buffers. I got the idea for this from the slots of Symfony’s PHP templating engine.

I have since broken this out of my WordPress theme helper classes into its own class and created a github repo, PHP-BufferManager to allow its use for generic purposes. This is a very simple repo and class. The most common way to use it would be to use $instance->start('name'); to start a buffer named ‘name’ and $instance->end(); to end it, then $instance->get('name'); at a later point to get the string value of the buffer for output or other purposes. A simple example:

Continue reading post "PHP Output Buffer Manager"

I’m on GitHub

A couple months ago I finally made my first repos on GitHub. It provides a good place for me to store some of the code I use in an easily accessible location and also offers the potential for others to be able to make use of it and even contribute to it. I definitely like it so far. It has been quite easy to work with and offers a rather nice web interface. I can now not only access these repos from anywhere (with internet connectivity), but also read the source with its file browser and reader and view commit history with diffs.

I started off by adding some Symfony related repos, three that will form a basis for my personal Symfony projects (Symfony-Initial, Symfony-BaseBundle, and Symfony-Shared). I also added another Symfony one related to a project I’m working on (Symfony-BaseBundle). Then I added some more generic web related ones, a new CSS repo Web-Presentation and my JavaScript codebase TMLib (Web-ClientBehavior). I’ve been working on TMLib for a while now and have been wanting to add it.

I will work on these as need warrants and time allows. I will probably continue to add more of my collections of code that I’m fine with making public.

Continue reading post "I’m on GitHub"