|
Sprockets: The Alkali Garden |
|
Everybody dance now ...
Da da da da
da da da da
da da da da, da da da
da da da da, da da da
la da da da
la da da da
dum da dum da dum
everybody dance now
C&C Music Factory, Everybody Dance Now
Those of us who enjoyed acid house back in the early 90's will be familiar with the concept of 'meaningless repetition' and how sometimes it is wonderfully appropriate.
However, when it comes to generating web forms, we really want to focus on the opposite of meaningless repetition. The opposite of Acid House would be something like Alkali Garden, which is today's theme. |
|
Read more...
|
|
|
Before I start work on the factory classes, there were a couple of loose ends in the Sprockets core class. We sometimes need to render self-closing tags, such as img or br, and we also need to format code nicely. The formatting issue isn't as trivial as you might think; indented html is far easier to read, easier to debug, and probably prevents cavities. |
|
Read more...
|
|
|
Sprockets: Some beta code |
|
As I outlined previously, Sprockets is a library designed to generate HTML in a neat, spiffy and generally rather swell manner.
Let's start by recapping what we hope a widget library is going to do for us. In short, the idea is to reduce a pile of spaghetti html into PHP objects that can be passed and manipulated consistently.
|
|
Read more...
|
|
|
Sprockets: A better PHP widget library |
|
As PHP has matured, its role has changed from an inline scripting engine 'helping' HTML, through a templating phase, to being a complete HTML generator. However, just as Captain Kirk was often reduced to fighting aliens with sticks and bright ideas instead of phasers and photon torpedoes, it can sometimes be a real chore to output HTML. It's as if things are made of wood when it comes to flexibly, programatically, generating HTML.
The objective of this series of articles is to introduce a widget set designed to generate hierarchical, standards-compliant HTML in an elegant, maintainable and extendable way.
The most important aspect is being extendable: generating HTML is the first baby step towards a well-designed scaffolding and formbuilding system. |
|
Read more...
|
|
|