(2015-07-19, 09:10 AM)Krytic Wrote: Or:
<setvar years>floor((TIME_NOW-$post['regdate'])/(60*60*24*365))</setvar> <span class="service-{$GLOBALS['tplvars']['years']}">{$GLOBALS['tplvars']['years']} years of service</span>
(The number will be an integer, ie 1, 2, 3, instead of one, two, three)
Then, in global.css, stuff like this works:
.service-1 { color: pink; } .service-2 { color: yellow; } .service-3 { color: red; } .service-4 { color: orange; }
et cetera, where the number is the number of years of service.
(2017-02-14, 07:24 PM)SvePu Wrote: Ok...you're right, but this should work:
<?php switch($x) { case ($post['regdate']+(60*60*24*30) <= TIME_NOW): echo '<div class="postbit-time-1month">1 month on MMH</div>'; break; case ($post['regdate']+(60*60*24*62) <= TIME_NOW): echo '<div class="postbit-time-2month">2 months on MMH</div>'; break; case ($post['regdate']+(60*60*24*182) <= TIME_NOW): echo '<div class="postbit-time-halfyear">1/2 year on MMH</div>'; break; case ($post['regdate']+(60*60*24*365) <= TIME_NOW): echo '<div class="postbit-time-year">1 year on MMH</div>'; break; default: echo ''; break; } echo $x; ?>
Thanks for the post. a good guide to customize

+1.
