How to use the new <search> element with WordPress

By
on · · 3 comments · 200 words
The Logo for WordPress

There's a new HTML element in town! You can now use <search> to semantically mark up a search box. It's great for letting screen-readers and other assistive tech know what a form does. It's only supported in WebKit for now - other browsers will get it eventually. The WordPress default search widget hasn't yet updated, […]

Continue reading →

Should the WordPress scheduler use datetime-local?

By
on · · 8 comments · 600 words
The Logo for WordPress

There's a brilliant post by WordPress about how they've optimised some of the backend code to make it more efficient. So here's a suggestion for something else which can be optimised. If you want to schedule a blog post to be published later, you have to use this WordPress control: I find it mildly annoying. […]

Continue reading →

Build your own "On This Day" page for WordPress

By
on · · 400 words
A graphic of a calendar showing the date "February 25 Sunday"

I blog. A lot. Too much really. One of the things I like to do is see what I was rambling on about this time last year. And the year before that. And so on. So, here's my On This Day page and here's how I built it. WARNING Extremely quick and dirty code ahead! […]

Continue reading →

Rewriting OpenBenches in Symfony

By
on · · 2 comments · 350 words
The Open Benches logo.

I once described my ideal coding environment to a colleague as "telneting directly into prod and damn the consequences!" I jest. But only a little. When I build for myself I treat best practices and coding styles as harmful. Chaotic evil but, hey, it's only myself I'm hurting. Anyway, my wife and I run a […]

Continue reading →

Getting Auth0 user information on non-firewall Symfony pages

By
on · · 250 words
Logo of the Symfony project.

I am using Auth0's Symfony library to allow users to log in with their social network providers. It works really well. Using this firewall configuration, a user who visits /private is successfully taken through the login flow and I can then use $this->getUser() to see their details. security: password_hashers: Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' providers: users_in_memory: { memory: […]

Continue reading →

Doctrine - difference between bindValue() and setParameter() on prepared statements

By
on · · 1 comment · 350 words · read ~169 times.
Doctrine project logo.

This pissed me off and I couldn't figure out what I was doing wrong. So I'm blogging about my ignorance. Imagine you're using Symfony and Doctrine to access a database. You are using prepared statements to prevent any SQL injection problems. There are two main ways of doing this - and they disagree about how […]

Continue reading →

Symfony - multiple paths to the same route within a controller

By
on · · 1 comment · 150 words · read ~196 times.
Logo of the Symfony project.

I couldn't work out how to use Route Aliasing within my controller. I couldn't find anything in the documentation about it. But, thanks to a StackOverflow comment it is possible. Suppose you want users to be able to access a page using /users/123 and /people/123 - with both routes displaying the same data? Normally you'd […]

Continue reading →

Fixing a weird issue with Symfony's Cache

By
on · · 200 words
Logo of the Symfony project.

I'm just getting started with Symfony, so I'm blogging some of the weird things I'm finding. Symfony has a concept of Cache Contracts. You can call an expensive / slow / intensive operation and immediately cache the result for a specific time period. Next time you call the operation, the results are served from the […]

Continue reading →

Doctrine - how to use LIKE with dbal prepared statements

By
on · · 1 comment · 150 words
Logo of the Symfony project.

I'm just getting started with Symfony, so I'm blogging some of the weird things I'm finding. I want to use Doctrine dbal to search a database for a partial match. For example searching for "smith" should find "blacksmith" and "smithy". I have a prepared statement like this: $queryBuilder = $conn->createQueryBuilder(); $queryBuilder ->select("whatever") ->from("table") ->where("name LIKE […]

Continue reading →

Help Wanted! Testing Better Markdown Footnotes

By
on · · 4 comments · 1,100 words · read ~307 times.
A very long footnote.

I've been thinking a lot about footnotes in Markdown. I've contributed a patch to make them slightly better in WordPress. Now I'm wondering how to make them more useful by enhancing their pop-up title text. To that end, I'm writing a patch for PHP Markdown which will display the first ~200 characters of a footnote […]

Continue reading →