Posts with tag: Regex

Code Snippet: A custom Twitter feed for your website

If you’re using a CMS you can simply find a handy plugin that displays your Twitter feed on your site, but if you’re working in a non-CMS framework then it’s more tricky. Here’s a handy piece of code you can use to get your twitter feed as well as any tweets that mention your name. I have also provided a simple function that uses regex to turn any URLs, hash tags or @mentions in your tweets into clickable links.

13 Comments Continue Reading →

Parsing URLs in PHP

In the past I have seen (and used) many functions in PHP that essentially serve the exact same purpose – they get specific elements from a page URL. They usually use some kind of regular expression to achieve this and are often around 10-15 lines in length. More recently I have discovered that these functions are pointless and have been since the advent of PHP 4.

1 Comment Continue Reading →