Following on from the previous post, I’ve also shamelessly poached another idea from Dunstan: human-readable timestamps.
Just pop this into your post.html file, where you want the ‘time’ to appear.
{capture name=hour}{the_time d="G"}{/capture} {assign var=hour value=$smarty.capture.hour} Posted {if $hour eq "00" or $hour eq "01" or $hour eq "02"} in the wee hours, {elseif $hour eq "03" or $hour eq "04" or $hour eq "05" or $hour eq "06"} terribly early in the morning, {elseif $hour eq "07" or $hour eq "08" or $hour eq "09"} early in the morning, {elseif $hour eq "10"} mid-morning, {elseif $hour eq "11"} late morning, {elseif $hour eq "12" or $hour eq "13"} mid-morning, {elseif $hour eq "14"} early afternoon, {elseif $hour eq "15" or $hour eq "16"} mid-afternoon, {elseif $hour eq "17"} late afternoon, {elseif $hour eq "18" or $hour eq "19"} early evening, {elseif $hour eq "20" or $hour eq "21"} evening, {elseif $hour eq "22"} late evening, {elseif $hour eq "23"} late at night, {/if}
I’ve inserted the code into my post.html file like you said. I have it located just below the entry’s title. However, all that shows up is the “Posted” portion. I don’t see “late morning”, “evening”, etc…
Any idea what may need to be changed in my layout so it does show up? Thanks for any help.
1 week after the fact.
I’ve got a new version in the works that uses JavaScript. I don’t know why this one won’t work, though.
Is this up on your blog, as I can’t see the results?
1 week after the fact.
Hi!
I can’t get how does this tool/tip must be used. Is the “new version that uses Javascript” posted in some place? Can you help me please?
All you teach us is awsome! Thanks a lot!
(Sorry for my bad english :S)
Bye!
1 year, 2 months after the fact.
You can get the JavaScript version from http://scripts.schinckel.net/timemods.js - but it probably relies on the script http://scripts.schinckel.net/toolbox.js, or HTMLtools.js.
The easiest way to implement it is to have:
<script src="http://scripts.schinckel.net/toolbox.js></script>In your head section of your main page template. You then get a heap of tools, some of which you may or may not want.
I’m not really supporting this, just making the code available.
1 year, 2 months after the fact.
This version above should now work again - it was a problem with quoting - HTML sometimes screws up quotes if you use a
<pre>tagset.1 year, 2 months after the fact.