The latest UserFriendly is a “Lynx Friendly” one! Hehe. Well, it beats the ones where they tried to find fault with Mozilla!
Monthly Archives: April 2004
PHP, MVC And Smarty Caching
Following on from previous posts on PHP and MVC and in particular on using Smarty caching in the MVC design pattern, I used Smarty to cache the output of an app at work this morning.
I agonised in my last post about where to put the caching, should it go into the viewer, or the model, or the controller?
- I finally decided to make the viewer responsilble for deciding if the template is cached or not.
- The controller then asks the viewer if the current page is cached, if it’s not, then it runs whatever functions the model needs to generate the page.
class mvcViewer
{
function mvcViewer()
{
$this->cacheKey = md5( $_SERVER[ 'REQUEST_URI' ] );
}function display()
{
// modified to use the cacheKey.
$this->assign();
$this->smarty->display( $this->formTplName . ".tpl", $this->cacheKey );
}function is_cached()
{
return $this->smarty->is_cached( $this->formTplName . ".tpl", $this->cacheKey );
}
}class mvcController
{
function main()
{
switch( $this->page )
{
default:
$this->model = new mvcModel( $form );
$this->view = new mvcView( $this->model, "mvc-Index" );
if( $this->view->is_cached() == false )
{
$this->model->doSomethingHere();
}
break;
}
}
}
The beauty of this is that the model doesn’t need to know about the caching at all. The developer can concentrate on the business logic of his application without worrying about the underlying architecture. That’s one reason for keeping the cache key in the viewer too. Don’t lets confuse the developer!
Of course, this presumes the most simplistic caching system, but it would suffice for most cases!
Presenting The Amazing Human Kleenex!
Looks like George Bush has been busy on TV! This video clearly shows him wiping his glasses on someone elses jumper on the Letterman Show! Is this real? Can it be real? I hope he asked first! 🙂
Read This… Via Hoffmania
Taking Risks, What Rules?
Andy Williams’ latest post to the STF has some great suggestions. Basically, throw out the rule book and experiment!
If you’ve a digital camera, why take only one photo when five will do?

Getting Married?
If you’re getting married soon then you’ll need a wedding dress won’t you?
STF: Panoramic Photos, and Street Photography
Two interesting threads on the STF today on panoramic photography and street photography, or shooting strangers. As usual Andy Williams posted an excellent summary of his own thoughts on candid photography.
Rekall, aka MS Access for Linux
I found a short review of Rekall via Linux Today this morning.
It has aspirations to be the MS Access of the Linux (and I suppose Free Software) world and while I’ve never used Access this little program looks impressive! The community supported RekallRevealed website has lots more, including screenshots and FAQs.
Opening URLs in Moz Firefox
Does anyone else have problems sending commands to a running instance of Mozilla Firefox?
I want Thunderbird to open links in new Firefox tabs but the following command fails:
$ mozilla -remote "openurl(http://www.mozilla.org, new-tab)"
Failed to send command.
$
If I don’t include a URL then a dialog pops up asking for one but that’s hardly what I want to happen. Google hasn’t been too helpful, but maybe someone reading this has come across this already!
The King Of Hearts – Live This Weekend!
Hear Ye! Hear Ye! The The King Of Hearts are going to be mighty busy this weekend playing gigs all over Cork and Kerry! Owen has more details but they’ll be appearing in the Coal Quay Bar on Sunday night where much drink will be consumed and a good night will be had by all! Be there or be.. oddly rectangular shaped.