1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Modification Sidebar: server online days

Discussion in 'Customizations & Modules' started by Lautaro, Sep 27, 2014.

  1. Lautaro

    Lautaro Administrator Developer

    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: Oct 14, 2014
    Clerigz, tezca, Netzo and 2 others like this.

Share This Page