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

Recent

Welcome to TinyPortal. Please login or sign up.

June 26, 2024, 10:00:53 AM

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

Block to show Holidays, Birthdays and Events

Started by nokonium, January 01, 2007, 10:35:40 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Nokonium

I have hacked it from other snippets and the existing SMF code. It is probably quite rough and open to improvement, but at least I didn't get a syntax error  ;D .

echo'
<div class="smalltext">';

$result = ssi_todaysHolidays('array');

if (!empty($result))
echo '
<span class="smalltext"><b>', $txt['calendar5'], ' ', implode(', ', $context['calendar_holidays']), '</b></span><br /><br />';
else
echo '';
echo'
<span><b>', $txt['calendar3'], '</b></span><br />';

$result = ssi_todaysBirthdays('array');
if (!empty($result))
{
foreach ($result as $member)
echo '
<span class="smalltext"><a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<b>' : '', $member['name'], $member['is_today'] ? '</b>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '</span><br /><br />' : ', ';
}

else
echo 'There are no birthdays today. <br /><br />';

echo'
  <span><b>', $txt['calendar4'], '</b></span><br />';

$result = ssi_todaysEvents('array');
if (!empty($result))
{
foreach ($result as $event)
echo '<span class="smalltext"><a href="' . '?action=calendar;' . '">' . $event['title'] . '</a></span><br />';
}
else
echo 'There are no events today. <br />
</div>';


I have updated the code, I found that the events link could be a little 'strange' so clicking on an event will now open the Calendar page.


Lum-chan


RoarinRow


SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

MrApples

There is already a event ssi funtion for TP, that shows events holidays and birthdays.

Nokonium

I am aware of that, but it doesn't differentiate between today and other days, all are upcoming and it just leaves a blank if there are none as opposed to saying that there are none. They are the reasons I put this block together.


jakemelon

nokonium,

How would one add a date prior to each event in this format MM/DD? so it would look like this:  2/14 Happy Hour
and remove Birthdays from it, just leave events list.

I like this snippet, I changed it a bit and it crashed. I am such a rookie...hahaha

jake


brianjw

This would be good if you just wanted those info to show up but I would rather use another code that shows a calendar and then the birthdays/events/etc :)

Brianjw

gmlong

Parse error: syntax error, unexpected T_STRING in /home/gmlong/public_html/stackedconnectors/forum/Themes/default/TPortalBlocks.template.php(35) : eval()'d code on line 10