I’ve finally written some reasonably easy addition to the ZenMagick PHP templating engine that allows to set the crumbtrail (and other bits, if required) in the actual view.
This is something I’ve been struggling for a long time. The crumbtrail code has been a source of bending backwards and ugly code for a very long time.
Now, the view can just do something like:
$crumbtrail->addCrumb('Foo') and be done! As you might have spotted, the code in itself hasn’t changed at all. The only change in the templates so far has been to the layout file to use the new
fragment() method to ‘mark’ the place where to put the crumbtrail and then *after* the view has been included the marker is filled with whatever crumbtrail has been set up.
One nice thing is that right now the views do not anything, because the crumbtrail is set up by the controller classes. So, it will be possible to migrate each view individually by moving the crumbtrail code from the controller class to the view template – yay!
Probably nothing to get too excited about, but it has been a long time coming…