Posts: 695
Threads: 91
Joined: Nov 2014
Reputation:
34
2018-05-09, 09:54 PM
I'd like to display forum up online days in the footer... for example if my forum has been up online running for a year then in the footer I'd like it to say 365 Days Online.
I've seen it done before in some forums not sure if it's a plugin or can it be done with php?
Thank you.
Do NOT PM me for support unless I ask you on your support thread.
Posts: 695
Threads: 91
Joined: Nov 2014
Reputation:
34
2018-05-10, 01:44 PM
(2018-05-10, 08:58 AM)effone Wrote: Fairly, your site start date is the registration date of your UID 1. So you can use that.
Add these 3 lines at the end of your global.php
$query = $db->simple_select('users', 'regdate', 'uid=1', array('limit' => 1));
$sitestart = $db->fetch_array($query);
$siteup = nice_time(TIME_NOW - $sitestart['regdate']);
Now you can use {$siteup} anywhere in your templates which will produce something like 3 Weeks, 3 Days, 11 Hours
Hard code or play with language files to prepend texts like "Site uptime:"
I guess that's what I was looking for and it worked thank you, but how can I remove weeks/days/hours? Instead I want it to say Days for example 300 days... 600 days.. 1000 and so on.
Do NOT PM me for support unless I ask you on your support thread.
Posts: 695
Threads: 91
Joined: Nov 2014
Reputation:
34
2018-05-11, 03:02 PM
(2018-05-11, 06:16 AM)effone Wrote: Try this:
$query = $db->simple_select('users', 'regdate', 'uid=1', array('limit' => 1));
$sitestart = $db->fetch_array($query);
$siteup = "Site online: <strong>".floor((TIME_NOW - $sitestart['regdate'])/86400)." days</strong>";
You may also like to cache the data to save a query in every page load.
Thanks pal.
Do NOT PM me for support unless I ask you on your support thread.