Not Solved <blank> years of service
#21
Not Solved
(2017-02-13, 10:34 PM)Wage Wrote: Show us the code that you're using.

This is in my postbit_classic:

				
<if $post['regdate']+(60*60*24*30) <= TIME_NOW then><div class="postbit-time-1month">1 month on MMH</div></if>
<if $post['regdate']+(60*60*24*61) <= TIME_NOW then><div class="postbit-time-2month">2 months on MMH</div></if>
<if $post['regdate']+(60*60*24*182) <= TIME_NOW then><div class="postbit-time-halfyear">1/2 year on MMH</div></if>
<if $post['regdate']+(60*60*24*365) <= TIME_NOW then><div class="postbit-time-year">1 year on MMH</div></if>



And this is in my global.css on my theme:
.postbit-time-1month {
width: 140px;
font-size: 11px;
text-align: center;
margin: 3px auto 0px auto;
padding: 4px 0px;
background: #181818;
border-radius: 3px;
}
.postbit-time-2month {
width: 140px;
font-size: 11px;
text-align: center;
margin: 3px auto 0px auto;
padding: 4px 0px;
background: #181818;
border-radius: 3px;
}
.postbit-time-halfyear {
width: 140px;
font-size: 11px;
text-align: center;
margin: 3px auto 0px auto;
padding: 4px 0px;
background: #181818;
border-radius: 3px;
}
.postbit-time-year {
width: 140px;
font-size: 11px;
text-align: center;
margin: 3px auto 0px auto;
padding: 4px 0px;
background: #181818;
border-radius: 3px;
}
Reply
#22
Not Solved
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>
Reply
#23
Not Solved
(2017-02-14, 06:24 PM)SvePu Wrote: 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>

It got rid of the 2 boxes but it's left me on "1 month" yet i've been a member over 2?
Reply
#24
Not Solved
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;
?>
Reply
#25
Not Solved
Worked a treat, thank you!
Reply
#26
Not Solved
How can you remove 0 years of service lol?
Do NOT PM me for support unless I ask you on your support thread.
Reply
#27
Not Solved
This user has been denied support. This user has been denied support.
very useful thanks for posting
Reply
#28
Not Solved
(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 Big Grin

+1.
Cool
Reply
#29
Not Solved
(2017-09-09, 08:06 PM)Livewire Wrote: How can you remove 0 years of service lol?

.service-0 {
display: none;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)