I posted this to the pres2 list, but either nobody read it, or nobody's interested. So, I'll try here.
I've been futzing around with pres2 and I'd like to propose a change in how the objects are organized. I think this will make it easier for people to work on designing new formats and also reduce the total number of LOC. Right now, we do something like this: class _example { function _example() { /* construct */ } function display() { $this->$mode; /* mode is html, plainhtml, flash, pdf */ } function html() { /* html display */ } function plainhtml() { /* plain display */ } function flash() { /* flash display */ } function pdf() { /* pdf display */ } } This makes it really hard to work through all the tag classes because there's tons on formatting code embedded in each object. Also, many display methods for one mode are implemented by calling the same method for another mode. (i.e.: function flash() { $this->html(); }) I propose we rip all these individual display functions out of the tag objects and put them in a separate object for each display format, like so: class html { function _example(&$example) { /* html() function previously in the _example class */ } } And make the display() function be: function display($mode) { $class = get_class($this); $mode->$class($this); } Where $mode is one of html, plainhtml, etc. This, IMHO, has a few advantages: 1) By extending from one class, we can easily override just the methods we want to modify to create new display formats. (For example, the flash class only needs to implement one method since everything else is just calling the html() method.) 2) From my perspective, people generally hack on the output for one format at a time instead of one tag at a time. This consolidates all the code they're working on into one common place instead of spreading it across a whole file. 3) When new tags are added, we can just add a basic implementation in a parent display class and nothing will break. Thoughts? Comments? -adam PS: In case you were wondering, I've actually already done all this and it works "on my machine." But I've only really tested the html output; I decided to wait on flash and pdf until I got some feedback on way or another. -- adam trachtenberg [EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php