Sinisterly
[Tutorial] How-To: Years of Service (Template Conditionals) - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Design (https://sinister.li/Forum-Design)
+--- Forum: Web Design (https://sinister.li/Forum-Web-Design)
+--- Thread: [Tutorial] How-To: Years of Service (Template Conditionals) (/Thread-Tutorial-How-To-Years-of-Service-Template-Conditionals)



[Tutorial] How-To: Years of Service (Template Conditionals) - Kawaii Love - 06-18-2015

Today, I will be giving you a tutorial on how to add years of service with template conditionals. The software of board being used in this tutorial is MyBB 1.8, however, any versions from 1.4 to 1.8 would be fine. Most of you have seen these type of additions on bulletin boards across the globe. I'm sure you would like to have one of these pages. All others are also welcome to help other individuals on this thread who may be having issues, problems, and, errors after or before reading this tutorial. Many threads will be created regarding MyBB (version) for owners and theme developers.

Well, maybe you have seen some forums with a message that says "One Year of Service" or "Two Years of Service" and so on, so here comes the easiest way to do it. Please notice that you must have installed PHP (template conditionals) in MyBB Templates. If you haven't installed template conditionals go here: http://mybbhacks.zingaburga.com/showthread.php?tid=260

1. Theme Templates
In your Templates section of the MyBB ACP, find the Post Bit Templates -> postbit or postbit_classic (choose the one that you use or add the code to both) and add the following code:

Code:
<if $post['regdate']+(60*60*24*730) <= TIME_NOW then><span class="two-years">Two Years of Service</span><elseif $post['regdate']+(60*60*24*365) <= TIME_NOW then><span class="one-year">One Year of Service</span></if>
Now add the following in your global.css:
Code:
.two-years { color: #F80; text-align: center; } .one-year { color: #FFFFFF; text-align: center; }



RE: [Tutorial] How-To: Years of Service (Template Conditionals) - Jasper - 06-18-2015

should be
Code:
<if $post['regdate']+(60*60*24*365) <= TIME_NOW then><span class="one-year">One Year of Service</span><elseif $post['regdate']+(60*60*24*730) <= TIME_NOW then><span class="two-years">Two Years of Service</span></if>

but ok.


RE: [Tutorial] How-To: Years of Service (Template Conditionals) - Aharon - 04-06-2016

Where the code put ?


RE: [Tutorial] How-To: Years of Service (Template Conditionals) - mehetts - 11-11-2017

where does the code go in postbit?