Drupal time ago function in template.php

· konordo

Would you like to make time appear as an interval like "4 days 3 hours ago"? Possibly you have worked with such formatters (drupal time ago) in views and date fields, but what about editing a node.tpl.php for example? Or programmaticaly include the last login time of a node's author, as time ago, in a block?

It comes in handy when there is a reusable function to format our time statements as drupal time ago - and php in general. So here comes a little function to be included in the template.php file. You can easily use it in your themes to display a timestamp as "Time ago".

YouTube validation errors: a quick fix

· konordo
In one of our latest projects we were asked to implement a video gallery for a famous choreographer, using videos already uploaded in YouTube. Well, it so appears that the code provided by Youtube fails the validation test with multiple errors, mostly concerning the "embed" element. Here is the code, as provided by YouTube.

<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/
v/FAM3tyAJ8Vw&hl=en&fs=1"></param>
<param name="allowFullScreen" value="true"></param>

Internet explorer CSS errors?

· konordo
We were working on a zen subtheme for a website when we came accross a very strange issue. Internet explorer would not render the CSS files properly. It would pick some css files, but more or less the page was scrambled. Strange issue indeed, as other browsers would display the content just fine. After some experimentation, we realised that this is happening for both drupal 5 and 6, for internet explorer 6 and 7. Tried to disable some modules, and played around with the zen configuration, all in vain...