TinyPortal

Development => Block Codes => Topic started by: winrules on November 06, 2005, 08:20:05 PM

Title: Upcomming events block
Post by: winrules on November 06, 2005, 08:20:05 PM
I'm wondering how to make a block that will show upcoming events in the calendar. I'm running 1.1 rc1. COuld i do this with a ssi function or would i need some php code?
Title: Re: Upcomming events block
Post by: scotte44 on November 06, 2005, 10:04:24 PM
Make a phpbox with:
ssi_todaysEvents();

If you want the font smaller like I did use:
echo '<span class="smalltext">';
ssi_todaysEvents();
echo '</span>';

I still havent figured out how to get the box to say none if there are no events, currently it will just be empty.
Title: Re: Upcomming events block
Post by: winrules on November 06, 2005, 10:18:53 PM
No, not just today's events but upcomming events (like all events in the next week)
Title: Re: Upcomming events block
Post by: iowamf on November 06, 2005, 11:44:08 PM
I just use the default SSI block for Today's calendar.  I'm not sure how far it looks out - but it appears it's at least two weeks.
Title: Re: Upcomming events block
Post by: winrules on November 07, 2005, 01:42:54 AM
ok thanks im really stupid :idiot2:
Title: Re: Upcomming events block
Post by: scotte44 on November 07, 2005, 05:36:38 PM
This block would be really nice if it had two things:
Each event listed on a seperate line &
The date of the event without putting it into the subject line
Title: Re: Upcomming events block
Post by: knat on August 28, 2006, 03:51:30 PM
Ok i know that this topic has been silent for over 120 days but i wanted to use this block so here goes:

When i enable this block it starts to show hollidays and Birthdays even thoug i have selected not to show this in the Calendar Admin section.. 

Can anybody help me fix it so it keeps not showing hollidays and birthdays when i use this block ?
Title: Re: Upcomming events block
Post by: foxfox on September 11, 2006, 10:23:48 AM
Quote from: scotte44 on November 07, 2005, 05:36:38 PM
This block would be really nice if it had two things:
Each event listed on a seperate line &


<?php
$result 
ssi_todaysEvents('array');
if (!empty(
$result))
{
   foreach (
$result as $event)
      echo 
'<a href="' $event['href'] . '">' $event['date'] . ' : ' $event['title'] . '</a><br >';
}
else
      echo 
'There are currently no events in the next XXX days.<br>';
?>


XXX is the timespan you set in the forums. The date might need some editing but i'm not that much of an expert.
Title: Re: Upcomming events block
Post by: manji on November 01, 2006, 01:06:54 PM
Can't seem to get this last code working on a php block :-\
Title: Re: Upcomming events block
Post by: akulion on November 01, 2006, 01:08:20 PM
Quote from: manji on November 01, 2006, 01:06:54 PM
Can't seem to get this last code working on a php block :-\

remove the <?php and ?> from the start and the end before putting ina  PHPbox
Title: Re: Upcomming events block
Post by: manji on November 01, 2006, 01:16:13 PM
thanks!
And is there a way I can get them to display with a space between events? So they display on a separate line, but with a space between lines :)
Title: Re: Upcomming events block
Post by: akulion on November 01, 2006, 01:20:17 PM
im making a guess since i dont use it myself but u could add another br at the end like so:


      echo '<a href="' . $event['href'] . '">' . $event['date'] . ' : ' . $event['title'] . '</a><br >';


like this

      echo '<a href="' . $event['href'] . '">' . $event['date'] . ' : ' . $event['title'] . '</a><br ><br >';
Title: Re: Upcomming events block
Post by: manji on November 01, 2006, 01:30:03 PM
That worked pretty well! Thanks!
Title: Re: Upcomming events block
Post by: akulion on November 01, 2006, 01:33:02 PM
welcome :up:
Title: Re: Upcomming events block
Post by: ckale on November 04, 2006, 03:55:04 PM
I am trying to make two blocks.

1-people who has birthday TODAY block. (i made it using phpbox, smf's calendar settings)

2-but i didn't make the block "upcoming 5 events" or "upcoming events in 15 days".

if I set smf's calendar settings "15 days", birthday block shows me "birthdays in 15 days", but I want birthdays today and events today+ 15 days

Is it possible?



Title: Re: Upcomming events block
Post by: ckale on November 11, 2006, 03:36:28 AM
Quote from: ckale on November 04, 2006, 03:55:04 PM
I am trying to make two blocks.

1-people who has birthday TODAY block. (i made it using phpbox, smf's calendar settings)

2-but i didn't make the block "upcoming 5 events" or "upcoming events in 15 days".

if I set smf's calendar settings "15 days", birthday block shows me "birthdays in 15 days", but I want birthdays today and events today+ 15 days

Is it possible?





I think it is impossible :( with block codes

Title: Re: Upcomming events block
Post by: JPDeni on November 11, 2006, 03:58:59 AM
It is impossible if you use the built-in functions, but perfectly doable with php code.
Title: Re: Upcomming events block
Post by: MaERcS on February 18, 2007, 10:33:26 AM
ThatÃ,´s a great block, but I want the date like that: "18/02" (Day/Month)
You know how to do it?

Thanks.
Title: Re: Upcomming events block
Post by: tick on February 23, 2007, 02:45:17 AM
Quote from: foxfox on September 11, 2006, 10:23:48 AM
Quote from: scotte44 on November 07, 2005, 05:36:38 PM
This block would be really nice if it had two things:
Each event listed on a seperate line &


<?php
$result 
ssi_todaysEvents('array');
if (!empty(
$result))
{
   foreach (
$result as $event)
      echo 
'<a href="' $event['href'] . '">' $event['date'] . ' : ' $event['title'] . '</a><br >';
}
else
      echo 
'There are currently no events in the next XXX days.<br>';
?>


XXX is the timespan you set in the forums. The date might need some editing but i'm not that much of an expert.
I am using this code in a block.  What do I need to add to this to make it show holidays and birthdays.   I dont know much about coding so if this is simple please excuse me
Title: Re: Upcomming events block
Post by: tick on February 23, 2007, 11:36:28 PM
I tried a couple of different thing today with this but still cannot get it to display birthdays.  I think I should be calling the calender instead of todays Events but am not sure how to do this.  any input anybody?
Title: Re: Upcomming events block
Post by: Porky on February 23, 2007, 11:42:42 PM
Look here it gives you a list of all the SSI functions... It might help you out
http://www.tinyportal.net/index.php?topic=2323.0
Title: Re: Upcomming events block
Post by: GhostRider2110 on May 26, 2009, 04:08:16 PM
I seem to be having an issue with one of my sites using this code.   I have a block to show upcoming events:

www.usscalemasters.org/forums (http://www.usscalemasters.org/forums)
SMF 1.1.9
TP 1.0 B4
Modified Blueskies theme



$result = ssi_todaysEvents('array');
if (!empty($result))
{
   foreach ($result as $event)
      echo '<center><a href="' . $event['href'] . '">' . $event['date'] . ' : ' . $event['title'] . '</a></center>';
}
else
      echo 'There are currently no events in the next 30 days.<br>';


After a period of time, not accessing the site, say over night... The front page will display there are not upcoming events in the next 30 days. Yet there are.  If you go to the Calendar, click on the month of June, where the next events are, then go back to the front page, they are now displayed.  I have had others test this and it has the same behavior.  But one anyone checks the calendar directly, then everyone can see the upcoming events on the main page...  FYI - both the upcoming events block and the Calendar block will not show anything....

No errors in the logs I can find.

Any help would be appreciated. 

--Mitch
Title: Re: Upcomming events block
Post by: GhostRider2110 on May 27, 2009, 07:44:39 PM
I guess I stumped the panel... :)   Or should I start a new thread? I still have not found any answer to this.  --Mitch
Title: Re: Upcomming events block
Post by: IchBin on May 27, 2009, 07:52:50 PM
Since its using only SSI pulled from SMF. There doesn't seem to be any way for us to control your issue. The code posted doesn't do any alteration of the code. It just outputs what the SSI function does. You should probably ask someone at SMF why that function is behaving that way.
Title: Re: Upcomming events block
Post by: GhostRider2110 on May 27, 2009, 08:44:16 PM
Ok, thanks.. it is really strange..  I am going to go through my SMF settings again just to see of maybe it's a server cache issue. It sure acts like it... --Mitch
Title: Re: Upcomming events block
Post by: GhostRider2110 on May 27, 2009, 08:48:45 PM
Just checked and no caching is enabled on the server...  Will query SMF help and report back what I find.. -- Mitch
Title: Re: Upcomming events block
Post by: GhostRider2110 on June 01, 2009, 03:37:17 PM
Well I have posts in SMF forums and a ticket open, but still no luck.  One interesting thing I noticed today, since we rolled into June, all the events for June are now showing up, but nothing after June... --Mitch
Title: Re: Upcomming events block
Post by: GhostRider2110 on June 04, 2009, 10:00:22 PM
Seems it was a mod messing things up.  Repeating Events for Calendar http://custom.simplemachines.org/mods/index.php?mod=655 was causing the problem.  I removed that mod and all seems to be working.  I kinda miss what it did, but you can still span events over multiple days. It's ability to have events repeat every month, or year or X number of days was nice...

--Mitch
Title: Re: Upcomming events block
Post by: rjackson on August 28, 2009, 09:21:03 PM
im lost, I tried to use this code but it dont work.. Im I using the wrong one?

$result = ssi_todaysEvents('array');
if (!empty($result))
{
   foreach ($result as $event)
      echo '<center><a href="' . $event['href'] . '">' . $event['date'] . ' : ' . $event['title'] . '</a></center>';
}
else
      echo 'There are currently no events in the next 30 days.<br>';

Title: Re: Upcomming events block
Post by: ZarPrime on August 29, 2009, 03:49:09 PM
rjackson,

In what way does it not work?

I tried the code on my test site using SMF 1.1.10 and TP 1.0 beta 4 and it works fine.  You need to make sure that you have events posted for the next 30 days or it won't show them.  Even if there aren't any events, the block will state that.  There isn't much more we can do to help you without having the information that is requested at the bottom of the posting guidelines.  So, if you require additional help on this, Please Read and Follow the Posting Guidelines (http://www.tinyportal.net/index.php/topic,581).

ZarPrime
Title: Re: Upcomming events block
Post by: rjackson on August 29, 2009, 04:41:57 PM
i got it working... gotta get use to that where to show function at the bottom..

Title: Re: Upcomming events block
Post by: ZarPrime on August 29, 2009, 04:50:57 PM
Glad you got it working.  :up:

ZarPrime