TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

October 06, 2024, 09:18:07 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,395
  • Total Topics: 21,244
  • Online today: 162
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 56
  • Total: 56

Holiday Blocks

Started by Skhilled, November 27, 2015, 02:36:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Skhilled

I got tired of waking up and realizing that I had forgotten or need to add something for a holiday on my site which is how I came up with the idea...a "set it and forget" type of thing. I've created blocks for every holiday with an image and now I don't have to deal with it except for the ones that don't have a specific date like Thanksgiving which is the last Thursday of that month.

Sayaka Maizono

I can make you a block that will display things based on various dates if you want.

william777


Sayaka Maizono

<?php

/**
 * @block Custom Dates
 * @author Rhode Fey (Sayaka Maizono)
 * @version 1.0.0
 * @for TinyPortal
*/

global $user_info;

$time time() + ($user_info['time_offset'] * 3600);
$current_date date('m'$time) . '-' date('d'$time);

if (
$current_date == '12-25')
{
echo '
Merry Christmas!'
;
}
elseif (
$current_date == '1-1' || $current_date '12-31')
{
echo '
Happy New Year!'
;
}
elseif (
$current_date == '7-4')
{
echo '
Happy Independence Day!'
;
}
// Default if current date is not specified.
else
{
echo '
Hello!'
;
}

?>

Skhilled