Flickr™ last.fm

9rules Round 4 is Approaching - Thursday 27th April 06

9rules are having another round of submissions and again I will be putting this site forward for consideration. This time however, I think I have a better chance of getting selected. (Still not a great one, but better than the last 3.) The first time I put the site forwards the guys sent out responses to everyone telling them why they were not getting accepted into the network.

While receiving the e-mail was a kick in the teeth I am much happier from it. While it may seem sad, being part of 9rules is something that I have been aspiring to be. In my e-mail Scrivs wrote that my consistency and quality of the posts were sub-par. These are the two things I now realise are the most important parts to any web-site.

At the time I thought that he didn't know what he was saying. I thought that my posts were great. Looking back however, he was so true. I used to think of a post, and then post it within 15 minutes for every post. There was no thought, no pre-planing and no effort. If you don't put the effort into writing a post why should somebody else into reading it?.

I have really been trying to get this site into something I am proud of. At the moment however, I am still not. To me this site still feels like a failure. I have had this domain name for over two years now and I still feel like the nobody I was when I started writing here. This was brought home to me by a post that Scrivs wrote asking:

If you walked away from your job right now would you be proud of what you have done?

Well if you turn this around to your web-site, if you do what Mark did in 2004 and left, would you be happy leaving your site? Would you be happy knowing you made a name for yourself? I know for sure I wouldn't.

This is something I am trying to turn around. I will no longer post on the same day that I have written the post. I also try to get all of my post proof read by someone (as to stop any typos or sentences that don't make any sense). These are two things that I would tell anyone who asked me how to improve the quality of their postings.

I think the key to having posts that are worth reading is if you have fun writing them. I can honestly say that writing on this site is becoming more fun. I never much liked English but it is growing on me. I can also say that I have taught myself more about writing from doing it in my free time than I ever got taught in school.

Consistency is something that still gets me however, the problem is that you can write your posts during the weekend when you have some free time. You don't want to ever post at the weekend though as the internet is usually quite quiet. For maximum exposure on the other hand you want to post mid-week.

This leaves me with a problem as I am usually too busy during the week to add the finishing touches to my posts and then post them. This is a problem I am trying to sort out and, at the moment I have been going for at least one post every two weeks. I try to post once a week where I can if time will allow.

Textpattern Time Since Function - Wednesday 5th April 06

When I first wrote my a move in a textpattern direction article, I was not telling the whole truth. There was one other change I made to the inner workings of textpattern. This change was making the time since handle deeper than just days but to months and years. As after about 10 days it is hard to picture how long that is.

note: This has only been tested with textpattern 4.0.3 while I have faith this function should work perfectly, I cannot be held responsible for you breaking your textpattern install.

To make this change I used an existing timesince function I have been using for ages. The function originates from NatBat. To make the change you will first need to backup publish.php, which can be found in the root of your textpattern install.

Next open the file up in your favorite text editor. Scroll down to line 848 (or search for "function since"). Then select the contents of that function (but not the function name or the last parenthesis) and delete it. In its place now pop in this function:

$older_date = $stamp;
$chunks = array(array(60 * 60 * 24 * 365 , 'year'),
        array(60 * 60 * 24 * 30 , 'month'),
        array(60 * 60 * 24 * 7, 'week'),
        array(60 * 60 * 24 , 'day'),
        array(60 * 60 , 'hour'),
        array(60 , 'minute') );

$newer_date = time();
$since = $newer_date - $older_date;

// step one: the first chunk
for ($i = 0, $j = count($chunks); $i < $j; $i++){
    $seconds = $chunks[$i][0];
    $name = $chunks[$i][1];
    if (($count = floor($since / $seconds)) != 0){
        break;
    }
}
$output = ($count == 1) ? '1 '.$name : "$count {$name}s";

// step two: the second chunk
if ($i + 1 < $j){
    $seconds2 = $chunks[$i + 1][0];
    $name2 = $chunks[$i + 1][1];
    if (($count2 = floor(($since - ($seconds * $count)) / $seconds2)) != 0){
        // add to output var
        $output .= ($count2 == 1) ? ', 1 '.$name2 : ", $count2 {$name2}s";
    }
}
return $output . " " . gTxt('ago');

Save the file and you have done the hard part. Now just turn the date format to time since in your install and the makeover should be complete. If you only want to use this on individual posts or such use the <txp:posted format="since" /> tag.

The best thing about this change is it turns totally invisible. So when you come to do a redesign you don't have to remember an plugin tag to use. Enjoy a proper timesince function responsibly.

© 2008 Edd Sowden