I would like to start making substantial changes in the way functions output their output. Specifically, I want to eliminate all of the "print" statements, and instead have handlers build up output and return it. The code in index.php that calls the handler would get the output returned to it, and print it. Does this model fit in with the thoughts on templating? I think they are complementary changes, using a templating engine is just a different (hopefully better) way to generate the output within the handler. Any problems with my plan that I'm not seeing?
Greg. -----Original Message----- From: Greg Schmidt [mailto:[email protected]] Sent: Sunday, April 26, 2009 9:47 PM To: 'Development discussion for the Leaguerunner league managementsystem' Subject: RE: [Leaguerunner] Thoughts on templating engines? The big difference between the Zikula module and "stand-alone" Leaguerunner is that the module doesn't use index.php at all, it's got it's own entry point. If the handlers all returned their output, index.php could just dump it, and the Zikula module could return it on to the next higher level. That would eliminate about 100 differences between the SVN version and TUC's running version, which would make maintenance a lot easier. Greg. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Dave O'Neill Sent: Sunday, April 26, 2009 8:51 PM To: Development discussion for the Leaguerunner league management system Subject: Re: [Leaguerunner] Thoughts on templating engines? Greg Schmidt wrote: > Definitely something to consider. The biggest problem that I have in the > integration of Leaguerunner as a Zikula module here is that Leaguerunner > expects to be able to just dump some output and exit any time it wants, but > Zikula needs the module output returned to it so that it can be wrapped into > a larger template. Seems that this might address that issue. Yeah, that should be possible. Once you have a Smarty object, you can either call $obj->display('file.tmpl') to print it directly, or $obj->fetch() to capture the output. We'd just have to structure our use of templates to make sure it's easy to do that in one place. > I know that Zikula uses Smarty, but I haven't got any direct hands-on > experience with it. Any idea how major a task this would be? If it looks > like a big enough project, it might be worth considering going all the way > to an MVC framework. There are a number of such beasts out there for PHP > now. I've been using one called CakePHP for my other projects, and every > time I go back to add something to Leaguerunner, I have to sigh and think > about how much easier it would have been to do it in Cake. I'd be happy to > put together a brief list of top features as they would apply to > Leaguerunner, if there's interest. Using templating is pretty much just a change to the Handler classes and their output rendering. It's a bit of work, but it would definitely contribute to maintainability, and it's something that could be done gradually. Switching to a framework like Cake would almost be a complete rewrite. I spent a few hours trying a conversion to Doctrine (another PHP MVC framework), and ended up deciding that it wasn't worth the effort. Any other MVC framework would require similar amounts of time. Frankly, if I had the time to spend on a rewrite, I'd pick a better programming language than PHP. Switching from Perl to PHP years and years ago for LR was a requirement of the hosting provider OCUA was using at the time. My biggest regret is that I didn't just find us a different hosting provider, rather than switch to PHP from Perl. Cheers, Dave _______________________________________________ Leaguerunner mailing list [email protected] http://www.dmo.ca/cgi-bin/mailman/listinfo/leaguerunner _______________________________________________ Leaguerunner mailing list [email protected] http://www.dmo.ca/cgi-bin/mailman/listinfo/leaguerunner
