CodeIgniter 2 and Bucket
Templating systems gone wrong
Tonight I decided to implement a templating system into CodeIgniter for a site I am making, something which I thought would be simple given that CI has lots of good libraries out there ready and waiting. It's not, it's a massive pain.
I spent a bit looking into the best templating systems (by look, I mean I found this thread on stackoverflow) and it came down to Ocular and Bucket. Bucket won due to its asset handling, something which I find annoying in CodeIgniter at the best of times.
So I downloaded the source, gave the docs a brief glance, and set to work. I've got to say, the library starts out great; I set it up pretty fast and got some basic templating working despite a lot of the documentation being out of date and wrong (this should have been a warning).
It was when I tried doing the minifying that all hell broke loose. The documentation skips over it completely. It makes it seem like all you have to do is set a variable to TRUE, but that didn't work for me. Time to look at the examples then.
I checked the advanced one because I thought it'd be the best place for it but got a blank screen. Oh, rewrite_short_tags is set to FALSE, and all the views use them. OK... Once I'd set it to TRUE, the example worked! However, no matter what I tried, I could not get my example to work. Turns out you need more files in your views (layouts/assets/index.php and content/assets/index.php) for it to work (or so it seems, I may just be really stupid and implementing it wrong). The fact these aren't included in the source is really frustrating, and they aren't mentioned in the docs either.
I ended up copying over all the files to my current build and eventually it worked after some fiddling about. I then tried to make minifying work on the basic example to see if I was just being stupid, but no luck there. I'm either really stupid, or the method to minify items isn't complete in the basic example and the source files.
I'd definitely recommend Bucket though, it's a great system and is actually really easy to use. Just make sure you use the advanced example as a base and it'll be a lot easier to implement!
UPDATE: The author has been in contact regarding my feedback and he is going to update the source and docs!