Problems, need help? Have a tip or advice? Post it here.
12 posts Page 1 of 2
Hi,

I know you can show a post by date, Time however i was wondering if you can show the new post by Minutes. Like this.

Posted 5 minutes ago then use the IF tag to then show in hours and then IF show in days
Hi Simon,

I think it'd be better to use JavaScript for this purpose.
I suggest you use the following script:http://timeago.yarp.com/

As their documentation states:
This will turn all abbr elements with a class of timeago and an ISO 8601 timestamp in the title:
<abbr class="timeago" title="2008-07-17T09:24:17Z">July 17, 2008</abbr>
into something like this:
<abbr class="timeago" title="July 17, 2008">5 years ago</abbr>
which yields: 5 years ago. As time passes, the timestamps will automatically update.

You can easily create the 'abbr' element mentioned above like this:
Code: Select all
<abbr class="timeago" title="<cms:show k_page_date />"><cms:date k_page_date format='M d, Y' /></abbr>

Hope this helps
Thanks for the info KK. I'll try it out and let people know.

Thanks for amending the title :lol:
Hi KK, hope you can help again.

I've added in all the code.

Code: Select all
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="../js/jquery.timeago.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$("abbr.timeago").timeago();
});

jQuery.timeago(new Date());             //=> "less than a minute ago"
jQuery.timeago("2008-07-17");           //=> "5 years ago"
jQuery.timeago(jQuery("abbr#some_id")); //=> "5 years ago"     // [title="2008-07-20"]
</script>


Then this into the main area of where i publish the date.

Code: Select all
<abbr class="timeago" title="<cms:show k_page_date />"><cms:date k_page_date format='%d %B %Y, %r' locale='English' /></abbr>


Which works fine, it loads line. Now i've got stuck. It only shows in hours, so about 1 hour ago then after another hour it goes to about 2 hours ago. How can i show this in Minutes, when goes into 60minutes then that goes into about 1 hour ago

Cant get my head around that part.
Hi Simon,

Can you post a link to the page where you are using this?
Thanks.
here's one more extra i've added just now,

http://automotive-media.co.uk/media/index.php?p=19


I've noticed that the time goes down, rather than up from 1 minute to 60 minutes.
In the latest page you just published, can you please let me know what text are you seeing and what was it that you expected to see?
When i make the post it shows about 1 hour ago. Then after a minute it shows 59minutes and counts down. Once the hour is up it shows about 1 hour ago again and then works up so after two hours is shows 2 hours ago.

What i want it to do is go from 1 minute ago to 59 minutes ago, then when at 60 it shows 1 hour ago, then works upwards in hours.
OK, I understand the problem now :)
I'll study it and let you know.
12 posts Page 1 of 2
cron