Trying out PhalconPHP – promising, but not quite there yet

After starting at my current job, which is in a company where almost everything is done with Microsoft technologies, I haven’t been coding much PHP. In my previous job I was developing the Finnish Facebook equivalent IRC-Galleria for 4 years. IRC-Galleria is PHP based, but since the codebase was started in 2000, the framework was self-built.

So basically I haven’t ever used any common PHP frameworks that much. I’ve done some projects with ASP.NET MVC framework which I’ve liked a lot. And I’ve done two freelancing projects using Symfony, which I didn’t like that much since it seemed really heavy and hard to get in to. I’ve tried CodeIgniter in some of my smaller projects and kinda liked it.

Now I was starting a new freelancing project for a custom online store and at the same time ran across PhalconPHP which kinda intrigued me. It seemed to lack all the things I’ve misliked in Symfony and partly in CodeIgniter. Everything seems to named simply and to my liking, for example controllers extend class Controller not CI_Controller. PHP5 namespaces are used appropriately. And the whole basic idea about the framework running as an extension instead of million PHP files just makes sense.

Their website and documentation seemed nice and even though there’s not that much previous user experience to search for, I was pretty confident that my skills are enough to get through obstacles. First I started developing for Phalcon 1.2.3, which is the current stable version, but I quickly updated to 1.3.0 branch which is still in development.

Here’s the TL;DR: I would NOT suggest using PhalconPHP for any production environment.

Don’t get me wrong, I really like Phalcon. There’s a lot of good things in it, but it’s simply not ready yet. There’s some elementary framework bugs still laying around, for example missing output escaping in some components. After reporting these bugs, there was a fix made quickly, but this fix caused another component to do double escaping. View inheritance has two ways of doing it, both missing some of the good in the other. The framework has ACL but no built-in components for user authorization or controller/action level access control although these are fairly easy to build yourself. So there’s still this kind of hard edges to sand through.

One big issue, which I was expecting from the start, was missing and unclear documentation. It seems that the documentation and code samples have been made too early and there’s been changes for later versions which haven’t been updated to the documentation. And since the framework is an extension, you can’t just easily browse through the framework code to find out what tools you have and how they work. Unless you know C of course, which I don’t.

For this project I’m seriously thinking about ditching Phalcon and doing it with CodeIgniter. Not quite sure yet whether to push forward or to bail out and go for the safe solution. Even if I do change now, I’m most definitely going to come back to PhalconPHP after it gets a bit more ready.

Markdown in phpBB3 – A quick hack using JS

After some googling I couldn’t find any solution for bringing Markdown support to phpBB so after a half a bottle of red wine I hacked it myself using markdown-js and a custom BBCode tag and got it working well enough. Here’s what I did.

1. Download markdown-js

Go to the phpBB install directory and download the file.


2. Add javascript to your theme template

If you got multiple themes in use, you’ll want to repeat this for all of them.

  1. In phpBB ACP go to Styles tab and under Templates click the Edit link.
  2. Choose overall_footer.html from the dropdown menu.
  3. Add the following markup just before the </body> tag.

    <script type="text/javascript" src="markdown.js"></script>
    <script>var els = document.getElementsByClassName('markdown'); for (var i = 0; i < els.length; ++i) { els[i].style.whiteSpace = 'pre'; els[i].innerHTML = markdown.toHTML(els[i].innerText); els[i].style.whiteSpace = ''; }</script>

Edit 2013-07-18: Fixed the javascript to set style.whiteSpace = 'pre' before reading innerText so duplicate spaces aren’t stripped.

3. Create custom BBCode tag

  1. In phpBB ACP, go to Posting tab and under BBCodes click the Add new BBCode button.
  2. In the first textbox enter

  3. And in the second textbox

    <div class="markdown">{TEXT}</div>
  4. Check Display on posting page if you’d like a shortcut button for the BBCode tag above the post editor.

  5. Hit Submit.

4. Fix theme styles

After the first three steps, you should already be getting results. What you’ll want to do next is fix the CSS styles for your themes.

  1. In phpBB ACP, go to Styles tab and under Themes click Edit link.
  2. If you’re using the prosilver theme, you’ll probably want to fix at least the following styles.

    .content .markdown p {
        font-size: 1em;
    .content .markdown h1 {
        color: #115098;
        margin: 1em 0;

Using Logitech diNovo Edge keyboard with a replacement A-Link BlueUSB4 bluetooth dongle

I absolutely love the Logitech diNovo Edge keyboard. This is my second diNovo in a row, the battery in the first one died after about 3 years of use.

I’ve never had much issues with either of the keyboards until now. The keyboards lose the connection every now and then but reconnect by flipping the keyboard power switch off and then on.

But recently I’ve had a lot of connectivity problems. Usually the keyboard works for 2-5 minutes after starting the computer and won’t connect after that no matter what magic tricks I pull. I tried connecting the keyboard to an iMac using it’s built-in bluetooth and it worked fine, so I figured the bluetooth dongle is broken.

The original receiver dongle hasn’t worked properly if I connect it to the back panel of my HTPC so I’ve had it in the front panel and it probably has gotten some physical abuse because of this every now and then.

I tried googling if I could replace the original dongle with a cheaper, smaller and probably better non-Logitech dongle but couldn’t really find any confirmation so I just went and bought an A-Link BlueUSB4 bluetooth dongle. Plugged it in, Windows 7 installed it automatically and a bluetooth icon appeared in the taskbar notification area. Clicked the icon, selected “Add a device” and after pressing the connect button under the keyboard all went smoothly and works a lot better than the original dongle, even from the other end of the apartment.