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

Recent

Welcome to TinyPortal. Please login or sign up.

April 18, 2024, 02:40:05 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 190
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 171
  • Total: 171

Looking for assistance to Get Calendar Events to list in a block

Started by Bixby, January 23, 2023, 01:30:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bixby

Hello:

Thank you for the TP Mod and even more, thank you for providing a forum to request support.

I am spinning up a new site and it is my first time using SMF 2.1 and first time also for using TinyPortal. I have managed a couple of SMF sites for a few years so I am comfortable with the concepts and admin of SMF in general.

Link to my site: https://community.pwyf.ca/
SMF version: SMF 2.1.3
TP version: 2.2.2
Default Forum Language: English
Theme name and version: Bend 1.2.3
Browser Name and Version: Chrome
Mods installed:
Simple Audio Video Embedder 7.0.1
SMF Gallery Lite 7.1
TinyPortal 2.2.2
Related Error messages: n/a

What I would like to do is have Calendar Events show up as a list showing the name of the event and the date. These events would be clickable to take the member/guest to the actual event posting. Events are 90% of the content and purpose foe the site.

I should also point out that I am not technical and do not know/understand coding.

Thank you very much in advance.
Matt

Bixby

As an additional semi related request, Can I get a list of recent topics instead of recent posts to show in a block? The Recent Topics seems to present me with a list of recent posts instead.

@rjen

Quote from: Bixby on January 23, 2023, 01:30:33 AM

What I would like to do is have Calendar Events show up as a list showing the name of the event and the date. These events would be clickable to take the member/guest to the actual event posting. Events are 90% of the content and purpose foe the site.

Create a php block where you want it and paste the below code into it...


$result = ssi_todaysEvents('array');

if (!empty($result))
{
   echo '<div class="smalltext"><a href="../index.php?board=28.0"><b>Upcoming events:</b></a></div>';
   echo '<div class="supersmalltext">';
   foreach ($result as $event)
      {
      $temp = explode('-', $event['date']);
      $event['date'] = $temp[2] . '-' . $temp[1] . '-' . $temp[0];
    echo '<a href="' . $event['href'] . '">' . $event['date'] . ' : ' . $event['title'] . '</a><br />';
      }
   echo '</div>';
}
else
{
      echo '<div class="supersmalltext">No upcoming events.<br /><br /></div>';
  }
Running Latest TP on SMF2.1 at: www.fjr-club.nl

@rjen

Quote from: Bixby on January 23, 2023, 01:31:58 AM
As an additional semi related request, Can I get a list of recent topics instead of recent posts to show in a block? The Recent Topics seems to present me with a list of recent posts instead.

If you are using the standard recent topics block, that will most definately show the topics and not the posts: recent posts would show the topics twice if the recent posts are in the same topics.
Recent topics shows the topics most recently posted to, not most recently created...

Why do you think it is showing incorrect?
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Bixby

Thank you for the quick reply. I added the code snippet and nothing is appearing. The events I currently have posted occur in March, do I need to post slightly different code to show all upcoming events for the next 180 days?

Regarding the Recent Topics, the latest replies are taking precedence so it is showing recent posts instead of recent topics.

Example at: https://community.pwyf.ca/index.php

@rjen

I forgot:  check you calendar settings for this setting; if too low it will not show events
Running Latest TP on SMF2.1 at: www.fjr-club.nl

@rjen

Recent topics is functioning the way it is intended on your site as far as I can see
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Bixby

Quote from: @rjen on January 23, 2023, 05:24:19 PM
I forgot:  check you calendar settings for this setting; if too low it will not show events

Amazing. Thank You!

I am disappointed in myself that I missed that earlier. :)

Any chance this can show date in YYYY-MM-DD format?

Bixby

Quote from: @rjen on January 23, 2023, 05:25:41 PM
Recent topics is functioning the way it is intended on your site as far as I can see

I thought Recent TOPIC would show new recent TOPICS and link to the first post in the topic. What I am seeing is that recent replies (Posts) are being shown / linked to instead.

@rjen

You will need to switch these date field around...

      $temp = explode('-', $event['date']);
      $event['date'] = $temp[2] . '-' . $temp[1] . '-' . $temp[0];

Temp0 is year
Temp1 is month
Temp2 is day

And replace the separators '-'  to whatever
Running Latest TP on SMF2.1 at: www.fjr-club.nl