WebEngine's 6th Anniversary

On December 19th, 2018 we will be celebrating 6 years of WebEngine CMS!
The event is here!

Modification Sidebar: server online days

Lautaro

Administrator
Developer
#1
Just a really small piece of code I thought some of you might like. It basically adds a block in the sidebar that will display the amount of days your server has been online for. It is manual set, meaning that you have to set the date you opened your server, the rest is done by the code.

Source code:
PHP:
    // SIDEBAR SERVER ONLINE DAYS
    $sod['onlineSince'] = "2014-09-01"; // YYYY-MM-DD
    $sod['onlineDays'] = floor((time()-strtotime($sod['onlineSince']))/86400);
    echo '<table class="sidebar-srvinfo" cellspacing="0" cellpadding="0">';
        echo '<tr><td colspan="2">Server Online Days</td></tr>';
        echo '<tr><td colspan="2" style="text-align:center;">'.$sod['onlineDays'].' day(s)</td></tr>';
    echo '</table>';
Compatibility:
  • WebEngine 1.0.5 PL1 or higher

How to add this to your site:
  1. Open the file /templates/<your template>/inc/modules/sidebar.php
  2. Add within the PHP tags the source code.
  3. Modify the variable $sod['onlineSince'] with the date you opened your server.
  4. Save.

Preview:
Untitled.png

Enjoy!
 
Last edited:
Top