How to tweet from your website with your own tinyurl URL shortening service
As this is my first post about Magic Hat, a little introduction. Magic Hat is a site for magicians to learn magic, with over 50 thousand users. I started it in 2004, and since then have gradually (or not so gradually) being changing it. We’re now at the 8th major redesign. It started as a good way to learn PHP/MySQL/HTML, so I didn’t touch any content management systems, and wrote the entire first 3 versions with linux’s best text editor, vim! I then treated myself to using Eclipse, which saves a lot of work – Ctrl + Space and your website’s done (I wish!). Then I chucked in a phpBB forum, modified it and my site so that they’re nicely integrated. Finally, I changed to using smarty templates, which has made changing the look of the site in the last few versions significantly easier – would highly recommend it.
So, you’ve probably gathered that I’ll happily reinvent the wheel many times over, but hopefully for a good result. Magic Hat is very dynamic and has lots of complicated features that I don’t think would have been feasible to get working in something like WordPress without having to learn and change most of WP.
I’ve setup the Magic Hat forums to tweet every time someone posts, but I didn’t really want to use tinyurl/bit.ly as I’d like to keep magichat.co.uk in the links. So, here’s some code that creates the smallest possible hash.