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

Recent

Welcome to TinyPortal. Please login or sign up.

December 04, 2024, 10:35:39 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,443
  • Total Topics: 21,252
  • Online today: 171
  • Online ever: 6,457 (November 30, 2024, 02:40:09 PM)
Users Online
  • Users: 0
  • Guests: 87
  • Total: 87

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