I’ve always been a casual VI/VIM user, I cut my teeth on FreeBSD as a server operating system and it was a guarantee that it would be installed. I learnt the basics of navigating around and editing and I did okay updating configuration files and paging through log files. I never adopted it as an editing tool, in fact up until recently I wrote off editing platforms that didn’t offer the power that a fully integrated IDE brings.
I’ll start this off with a quick caveat that this is something really simple; that if you’re accustomed to Drupal then you’ll think, “of course, you don’t need to blog this”. However being fairly new to working with Drupal, this caught me out for too long, so if this helps just one other person I’ll be happy!
Leveraging Yii! 2 Controller Actions and Behaviours
It all started so simple, a basic competition mechanic quickly became two different mechanics with more variations in the future. It could have quickly became a mess of code, multiple controllers each supporting different mechanics and with shared code being copied and pasted. Very easy to go down that road, especially when the time scales are short. A little bit of thinking and a look at what is available in the Yii framework soon led us away from this route.
We roll out so many CRUD (Create Read Update Delete) pages in the course of our projects and life for that matter. And so often there’s a list or grid view for all the existing entries and of course, there’s the obligatory search form at the top. How this should behave is probably up for debate but in my opinion the best way is that while you’re in that section of the site the search data should remain.
Recently I had the requirement to have a route that was powered by the database, the Yii docs cover this, but having the create and parse run at the same point was problematic. The situation was that the route was just a controller and an action with search form parameters, of course the route parsed to createUrl() would be just “controller/action”; there was a normal “/” rule as well.
If I wanted the createUrl() method to return the database powered slugs then the custom url rule would need to be above the generic rule.
I noticed over Christmas that open source projects seem to get work done when the developers are not at work. This makes perfect sense but I’d not noticed it really until now, two projects that I use both got updates over the holidays. K9 Mail, a mail client for Android, got updated, bugs fixed and features added that I never new I was missing. The new feature to go to the next message when you delete is nice though, thanks for that K9 team.
Well here we go then! My site has languished with no love nor attention for many years. To be honest I had very little use for it, nor any desire to spend time working on it. Now, however, it’s time it became something more than it was, for a start, my recent review at work said that I had to start blogging on tech related topics, so I had to get a blogging platform.