TinyPortal

Development => Block Codes => Topic started by: Nokonium on January 01, 2007, 10:35:40 PM

Title: Block to show Holidays, Birthdays and Events
Post by: Nokonium on January 01, 2007, 10:35:40 PM
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.
Title: Re: Block to show Holidays, Birthdays and Events
Post by: brianjw on January 01, 2007, 10:37:36 PM
cool :) Thanks 8)
Title: Re: Block to show Holidays, Birthdays and Events
Post by: Lum-chan on January 02, 2007, 12:36:53 AM
Nice one. Added it to my portal.
Title: Re: Block to show Holidays, Birthdays and Events
Post by: RoarinRow on January 02, 2007, 01:17:18 AM
Yup, very cool   8)
Title: Re: Block to show Holidays, Birthdays and Events
Post by: MrApples on January 06, 2007, 05:35:23 PM
There is already a event ssi funtion for TP, that shows events holidays and birthdays.
Title: Re: Block to show Holidays, Birthdays and Events
Post by: Nokonium on January 06, 2007, 08:54:18 PM
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.
Title: Re: Block to show Holidays, Birthdays and Events
Post by: Kassie on January 17, 2007, 04:56:58 AM
Thank you :)
Title: Re: Block to show Holidays, Birthdays and Events
Post by: jakemelon on February 13, 2007, 12:15:31 AM
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

Title: Re: Block to show Holidays, Birthdays and Events
Post by: brianjw on February 13, 2007, 12:23:44 AM
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
Title: Re: Parse error...Help
Post by: gmlong on October 28, 2007, 06:07:26 PM
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
Title: Re: Block to show Holidays, Birthdays and Events
Post by: Zetan on October 28, 2007, 06:21:32 PM
The script seems to have been messed up.. likely caused when tinyPortal recently moved servers..

If you actually look at the script..



Ã,  Ã,  Ã,  echo '';Ã,  Ã,  Ã,  Ã,  Ã,



for example.. it's clearly wrong.. it will never work until it has been corrected.
Title: Re: Block to show Holidays, Birthdays and Events
Post by: IchBin on October 28, 2007, 07:52:26 PM
Should be fixed now.
Title: Re: Block to show Holidays, Birthdays and Events
Post by: MinasC on October 29, 2007, 12:22:14 AM
Parse error: syntax error, unexpected T_FOREACH in /home/minasc/public_html/forumv3/Sources/Load.php(1834) : eval()'d code(35) : eval()'d code on line 17
Title: Re: Block to show Holidays, Birthdays and Events
Post by: JPDeni on October 29, 2007, 12:54:02 AM
Looks like there's still an artifact from the move on line 17. Change it so it's


foreach ($result as $member)
Title: Re: Block to show Holidays, Birthdays and Events
Post by: Nokonium on October 29, 2007, 07:19:23 AM
I've corrected it  :)
Title: Re: Block to show Holidays, Birthdays and Events
Post by: MinasC on October 29, 2007, 11:13:16 AM
works great now ! two requests :

1) could it show the date (just the date , like october 29 , 2007 , without the time) just before every birthday and event ? i guess that would mean that every birthday/event should be in its own line .

2) could it show the birthdays/events of the present month even if they are of a past day of the month ? (the concept is that i want to let my members know of a birthday that has passed 2 days ago - for example - so that they can wish even a bit late).

thnx a lot in advance !
Title: Re: Block to show Holidays, Birthdays and Events
Post by: thelastzodiac on October 30, 2007, 03:30:11 AM
This is a Excelent script, thankyou!!

  :up: :up: :up: :up: :up:  5 Thumbs up!!  :D
Title: Re: Block to show Holidays, Birthdays and Events
Post by: MinasC on November 22, 2007, 08:33:36 PM
Quote from: MinasC on October 29, 2007, 11:13:16 AM
works great now ! two requests :

1) could it show the date (just the date , like october 29 , 2007 , without the time) just before every birthday and event ? i guess that would mean that every birthday/event should be in its own line .

2) could it show the birthdays/events of the present month even if they are of a past day of the month ? (the concept is that i want to let my members know of a birthday that has passed 2 days ago - for example - so that they can wish even a bit late).

thnx a lot in advance !

isn't there any way to do those ?
thnx
Title: Re: Block to show Holidays, Birthdays and Events
Post by: Nokonium on November 22, 2007, 09:25:37 PM
All I have done is utilised two SMF SSI's.

The settings that control the SSI's are the SMF Features and Options 'Default time format' or the Profile 'Time Format:' and Calendar Settings 'Max days in advance on board index:'
Title: Re: Block to show Holidays, Birthdays and Events
Post by: MinasC on November 23, 2007, 04:01:34 PM
eeehm , sorry but i didn't understand a thing ! not a coder you see ! most of all i care about the block showing birthdays , events and holidays of the present month instead of the current day's . is that possible ?

(sorry for me not understanding , but i couldn't possibly "play" with the ssi , seems like a foreign language to me !)

thnx a lot !
Title: Re: Block to show Holidays, Birthdays and Events
Post by: IchBin on November 23, 2007, 04:09:48 PM
Basically what I get that he's telling you is that he isn't a coder either. He understands the basics from what I can tell, but he appears to be saying you're on your own if you want something more to be output from it, unless someone else is willing to look at it.
Title: Re: Block to show Holidays, Birthdays and Events
Post by: jacortina on November 23, 2007, 04:32:13 PM
Check to see if this block would suit -
http://www.tinyportal.net/index.php?topic=700.msg160852#msg160852
Title: Re: Block to show Holidays, Birthdays and Events
Post by: MinasC on November 24, 2007, 10:38:16 AM
Quote from: J.A.Cortina on November 23, 2007, 04:32:13 PM
Check to see if this block would suit -
http://www.tinyportal.net/index.php?topic=700.msg160852#msg160852

wow , that is great mate , used it already and works fine , except from the language thing , but i will post that in that thread , not here ! thnx !
Title: Re: Block to show Holidays, Birthdays and Events
Post by: Keurigirl on January 12, 2008, 10:09:27 PM
I would love to have this, but where do I put the code?
Title: Re: Block to show Holidays, Birthdays and Events
Post by: IchBin on January 12, 2008, 10:14:35 PM
In a phpbox block type or article.
Title: Re: Block to show Holidays, Birthdays and Events
Post by: Keurigirl on January 12, 2008, 10:17:24 PM
When I do that, I get a: Parse error: syntax error, unexpected $end in /home/steph71/public_html/flourishbaby/flourish/Sources/Load.php(1751) : eval()'d code(35) : eval()'d code on
Title: Re: Block to show Holidays, Birthdays and Events
Post by: IchBin on January 12, 2008, 10:22:56 PM
Then you probably didn't copy/paste the code. Or something is missing. The code worked for me.
Title: Re: Block to show Holidays, Birthdays and Events
Post by: Keurigirl on January 12, 2008, 10:28:49 PM
Nevermind, I am retarded. :) I figured it out. Thanks so much for helping a sort of newbie.
Title: Re: Block to show Holidays, Birthdays and Events
Post by: Niagra on January 21, 2008, 05:23:09 AM
Ok so may I verify the code needed to simply show the current months  birthdays?  Not just that days .. But all the birthdays in the current month please.

Block could be This Months Birthdays

with the day - member ie:
10- Niagra
25 - Peter Pan

Thanks for your help.  As always.
Title: Re: Block to show Holidays, Birthdays and Events
Post by: Nokonium on January 21, 2008, 07:40:29 AM
http://www.tinyportal.net/index.php?topic=11943.msg164912#msg164912