MyBB Community Forums

Full Version: <blank> years of service
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
(2016-01-08, 10:44 AM)Zeeks Wrote: [ -> ]How would you make this into  months instead of years?

<if $post['regdate']+(60*60*24*31) <= TIME_NOW then><span style="color: gold;">One Month of Service</span></if> 
it work on local host but not showing years/months on running board.
what may be the issue?

i use following code for months:
<setvar years>floor((TIME_NOW-$post['regdate'])/(60*60*24*30))</setvar>
<span class="service-{$GLOBALS['tplvars']['years']}">{$GLOBALS['tplvars']['years']} months of service</span>

Following code for years:
<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> 

Work fine on local host but not on running board.

Below code is also not working.
<if $post['regdate']+(60*60*24*30) <= TIME_NOW then>1 month services
<elseif $post['regdate']+(60*60*24*330) <= TIME_NOW then>11 months services
<else/></if>
(2016-01-09, 06:37 AM)Dr_The_One Wrote: [ -> ]it work on local host but not showing years/months on running board.
what may be the issue?

i use following code for months:
<setvar years>floor((TIME_NOW-$post['regdate'])/(60*60*24*30))</setvar>
<span class="service-{$GLOBALS['tplvars']['years']}">{$GLOBALS['tplvars']['years']} months of service</span>

Following code for years:
<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> 

Work fine on local host but not on running board.

Below code is also not working.
<if $post['regdate']+(60*60*24*30) <= TIME_NOW then>1 month services
            <elseif $post['regdate']+(60*60*24*330) <= TIME_NOW then>11 months services
<else/></if>

Did you remember to install the plugin on the running board as well?
How to show 0 years,1/2 year, 1 1/2 years of service?
any idea?
This goes to the postbit
<if $post['regdate']+(60*60*24*182) <= TIME_NOW then><div class="postbit-time postbit-time-halfyear" style="margin-top: 3px;">1/2 Year of Service</div></if>
<if $post['regdate']+(60*60*24*365) <= TIME_NOW then><div class="postbit-time postbit-time-halfyear" style="margin-top: 3px;color: #85AE31;">One Year of Service</div></if>
<if $post['regdate']+(60*60*24*700) <= TIME_NOW then><div class="postbit-time postbit-time-halfyear" style="margin-top: 3px;color: red;">Two Years of Service</div></span></if>
</div>

CSS:
.postbit-time-halfyear {
   color: #2574A9
}

.postbit-time {
   width: 140px;
   padding: 4px 0;
   text-align: center;
   border-radius: 3px;
   font-size: 11px;
   text-shadow: none;
   margin: 0 auto;
   font-weight: 500;
   background: #181818
}

This was coded by me, Dont copy it to other forums.
(2016-08-21, 05:16 PM)Cryptexinside Wrote: [ -> ]This goes to the postbit
<if $post['regdate']+(60*60*24*182) <= TIME_NOW then><div class="postbit-time postbit-time-halfyear" style="margin-top: 3px;">1/2 Year of Service</div></if>
<if $post['regdate']+(60*60*24*365) <= TIME_NOW then><div class="postbit-time postbit-time-halfyear" style="margin-top: 3px;color: #85AE31;">One Year of Service</div></if>
<if $post['regdate']+(60*60*24*700) <= TIME_NOW then><div class="postbit-time postbit-time-halfyear" style="margin-top: 3px;color: red;">Two Years of Service</div></span></if>
</div>

CSS:
.postbit-time-halfyear {
   color: #2574A9
}

.postbit-time {
   width: 140px;
   padding: 4px 0;
   text-align: center;
   border-radius: 3px;
   font-size: 11px;
   text-shadow: none;
   margin: 0 auto;
   font-weight: 500;
   background: #181818
}

This was coded by me, Dont copy it to other forums.

Yeah, don't copy that into other forums.

He's using "postbit-time" and "postbit-time-halfyear" (two classes) to style all but at the same time is putting raw css in the same label (style="margin-top: 3px;color: red;").

------------------------------

Instead, you can copy this code in what forum you want:

<if $post['regdate']+(60*60*24*182) <= TIME_NOW then><div class="postbit-time-halfyear">Half year of service</div></if>

.postbit-time-halfyear {
width: 140px;
font-size: 11px;
text-align: center;
margin: 3px auto 0px auto;
padding: 4px 0px;
background: #181818;
border-radius: 3px;
}

By the way, this was coded by me using CSS, an open source language that describes the style of an HTML document.
@up Well, Yeah he dont need to make .postbit-time-halfyear
he can edit the color in the div this will make his work easier since he just need the .postbit-time
I love how the second example is what I did for another MyBB forum.
(2017-02-13, 10:10 PM)DaNnIbOi Wrote: [ -> ]Can someone help me here? I have it working thanks to @eNvy

But now it's showing like this:
[Image: service.png]

How do I get rid of the first one, when the second one is due to kick in?

Show us the code that you're using.
Please, try this:
<if $post['regdate']+(60*60*24*30) <= TIME_NOW then>
	<div class="postbit-time-1month">1 month on MMH</div>
<elseif $post['regdate']+(60*60*24*61) <= TIME_NOW then>
	<div class="postbit-time-2month">2 months on MMH</div>
<elseif $post['regdate']+(60*60*24*182) <= TIME_NOW then>
	<div class="postbit-time-halfyear">1/2 year on MMH</div>
<elseif $post['regdate']+(60*60*24*365) <= TIME_NOW then>
	<div class="postbit-time-year">1 year on MMH</div>
</if>
Pages: 1 2 3