Dynamically load Twitter Tweet and Facebook Like button

This is a good technique to use as it saves having to load loads of share buttons on every page load which often slow the page down. Just had to do this and needed a few lines to get it working.

Whether you have the code hidden somewhere on your page before it's needed or load it via AJAX is irrelevant, but once it's included on the page, you need the following code to initialise the buttons. 

if(typeof twttr != 'undefined')
{
	twttr.widgets.load();
}
FB.XFBML.parse(document.getElementById('container'));

If you add one Tweet button dynamically it seems to initialise itself, but later ones need this code. As well as this, 'twttr' won't exist until the first one is created but will after, so we only need to run that once it's defined; isn't needed for the first one anyway.

For the Facebook one, you need to specify the ID of a container of the post or something, and it'll find any FB elements inside that it needs to initialise.

After that, should work fine.

New site!

Hello.

Over the past few weeks I've been writing a new site and it's at a state now where I can replace my current one. WordPress is good but has loads of stuff that I don't use and I don't really know how it works, and I've always wanted to build my own site, so here we go.

As you can probably see, I'm not a designer, but sometimes less is more. Think it looks alright myself.

I've built this using the Kohana PHP framework (the older one as we use it at work and I know it, couldn't be bothered to learn a newer framework as I just wanted to get this built) and Twitter Bootstrap as the front end framework, which I now love. It makes the site responsive (scales nicely to fix widescreens, normal screens, tablets and smartphones) and comes with loads of utility styles to save you loads of time. That's what I like about using frameworks, they save you writing all the crappy boring stuff and let you get straight into building what you want.

I've also got a little Ask Me feature like Tumblr/Formspring so feel free to ask me something if you have nothing better to do.

Things will probably be a bit broken but I'm sure I'll find the problems myself soon enough.

I've imported some of the better/more recent posts from my old site (which can still be found here). Please forgive some of the silly things I went on about when I was a bit younger.

If you have any feedback on the site then please let me know as I'll always be looking to improve it.

I'll also try to use this one a bit more than my old one too :)