• Homepage

    Auto-Update Your Copyright for PhpLD

    June 2nd, 2008

    This is no complicated hack, but it comes in handy because it such a small thing.  I know I always forget about it.

    Open init.php and find

    [php]?>[/php]

    Above Add

    [php]//Auto Update Copyright
    $start_year = ’2007′;
    if($stary_year < date('Y')){
    $copyright = $start_year . ' - ' . date('Y');
    }else{
    $copyright = $start_year;
    }
    $tpl->assign(‘copyright’, ‘Lobo Links Directory &copy ‘.$copyright);
    //Auto Update Copyright[/php]

    Open templates/your_template/footer.tpl and add where you want your copyright to show.

    [php]{$copyright}[/php]

    That is it.  Wuwu!

    Edit After some discussion on the DP Forums, Aubenry shared a way to do it with smarty.

    [php]© Yourdomain.com {if $smarty.now|date_format:”%Y” gt 2007} 2007 – {$smarty.now|date_format:”%Y”} {else} 2007 {/if}All Rights Reserved[/php]

    I think I could do a more fancy version, but that one is just too simple.

    Related Post

    Posted in Directory Owner Tips