Two questions re: calendar events...

Started by lemur21, September 29, 2006, 09:39:49 AM

Previous topic - Next topic

lemur21

Hello,

I have two questions re: calendar events...I'm not even 100% sure if this is in the right place.

First, I need to confess that I am NOT a techie by any means -- I am lucky to have figured out as much as I have; but I do not know how to code. I can follow instructions well, however :) Fortunately, I found SMF to have 95% of the features I wanted out of the box; and adding mods/themes, etc. is pretty easy, and doesn't really require any coding experience.

OK - the two questions:

1) I've adjusted the calendar.template.php file to allow me to have titles for calendar events exceeding 30 characters (I've set mine to 60). However, apparently I also need to 'alter the table' to allow that to happen. I've no idea what that means.

2) Also, I'd LOVE to be able to set up the 'upcoming events' on the index page to list each event with its respective date; and (possibly) be placed on it's own line.

Right now, if I list all events for the next 60 days, I get: Upcoming events: GameDay*, GameDay*, GameNite*, GameDay*. I'd rather it look like this:

9/30 - GameDay*
10/21 - GameDay*
10/27 - GameNite*

(where the date could be that format or any other real format).

In case peope need to see it, here's my page: http://www.libogroup.com/SMF/index.php  I'm using 1.1RC3.

Thank you so much in advance! If this should be posted elsewhere, please let me know, and I'll go ahead and do that.

Chris

truelight5

I don't have any answers for you but I agree that being able to display the upcoming events in the manner you describe would be an incredible added feature to the software...I was just pondering that this afternoon...

=o)

Blessings!
Susie

MarkRH

A somewhat cheesy (but easy) way to do this for events you add, is just add the date and time at the front of the event description which will then cause it to show in the Board Index. 

I found the place in the BoardIndex.template.php file that outputs the calendar event information... but I'm too tired to figure out which variable to get the actual date from in order to output it.  I want to though.. as I would like the dates to display by the event. 
Mark H.

codenaught

Do achieve the line break and to show the date of the event next to the event:

Open Themes/theme_name/BoardIndex.template.php,

Find:

// Events like community get-togethers.
if (!empty($context['calendar_events']))
{
echo '
<span style="color: #', $modSettings['cal_eventcolor'], ';">', $context['calendar_only_today'] ? $txt['calendar4'] : $txt['calendar4b'], '</span> ';
/* Each event in calendar_events should have:
title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. */
foreach ($context['calendar_events'] as $event)
echo '
', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<b>' . $event['title'] . '</b>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br />' : ', ';


Change to:

// Events like community get-togethers.
if (!empty($context['calendar_events']))
{
echo '
<span style="color: #', $modSettings['cal_eventcolor'], ';">', $context['calendar_only_today'] ? $txt['calendar4'] : $txt['calendar4b'], '</span> ';
/* Each event in calendar_events should have:
title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. */
foreach ($context['calendar_events'] as $event)
echo '
', $event['date'], ' - ', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<b>' . $event['title'] . '</b>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br />' : ', <br /> ';


For increasing the length allowed for event names you can run this query in phpmyadmin,

ALTER TABLE `smf_calendar` CHANGE `title` `title` VARCHAR( 60 )

Changing smf_ to your database prefix if that isn't your database prefix. Do backup your database before you run this query though.

What is phpMyAdmin?
Dev Consultant
Former SMF Doc Coordinator

lemur21

Thanks! I'll check out the phpmyadmin link as well!

I also have my groups birthdays on the main page, as well -- is there anyway to have THAT also show the line break and date of the event?

Thanks so much, again! This is an enormous help!

Chris

codenaught

Open Themes/theme_name/BoardIndex.template.php

Find:

foreach ($context['calendar_birthdays'] as $member)
echo '
<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'] ? '<br />' : ', ';


Change to:

foreach ($context['calendar_birthdays'] as $member)
echo '
', $member['date'], ' -
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<b>' : '', $member['name'], $member['is_today'] ? '</b>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a> <br /> ';


Open Sources/BoardIndex.php

Find:

foreach ($bday[strftime('%Y-%m-%d', $i)] as $index => $dummy)
$bday[strftime('%Y-%m-%d', $i)][$index]['is_today'] = strftime('%Y-%m-%d', $i) == strftime('%Y-%m-%d', forum_time());


Change to:

foreach ($bday[strftime('%Y-%m-%d', $i)] as $index => $dummy)
{
$bday[strftime('%Y-%m-%d', $i)][$index]['is_today'] = strftime('%Y-%m-%d', $i) == strftime('%Y-%m-%d', forum_time());
$bday[strftime('%Y-%m-%d', $i)][$index]['date'] = strftime('%Y-%m-%d', $i);
}
Dev Consultant
Former SMF Doc Coordinator

lemur21

That worked like a charm - now birthdays and events are lined up with the dates! Thanks! That was the last "big" thing I wanted to fix on the site!

I still can't get the event length to change.

I modified calendar.template and post.template and changed the evtitle length to "60" for both.

However, the theme I'm using (amber) didn't have either of those files in it - so I modified the files for the default theme first; then, when that didn't work, copied those files INTO the amber directory.

I also altered the table smf_calendar to a length of 60 (or, rather, my friend did) -- I don't know, is there a smf_calendar_events table that needs to be altered as well?

So, while I can enter more than 30 characters, when I hit 'post' only 30 show up on the calendar. I can edit the title, and THEN, more than 30 will show up - but that means you have to post, then edit, then post again.

I'm not sure why...

Chris

codenaught

Found the culprit. :)

Open Sources/Subs-Post.php

Find:

if (strlen($_POST['evtitle']) > 30)
$_POST['evtitle'] = substr($_POST['evtitle'], 0, 30);

And change both occurrences of 30 to the number you want, in your case it would probably be 60.
Dev Consultant
Former SMF Doc Coordinator

lemur21

Yep - that did it! Thanks so much!!!

Chris

MoreBloodWine

Quote from: akabugeyes on October 03, 2006, 05:05:25 PM
Found the culprit. :)

Open Sources/Subs-Post.php

Find:

if (strlen($_POST['evtitle']) > 30)
$_POST['evtitle'] = substr($_POST['evtitle'], 0, 30);

And change both occurrences of 30 to the number you want, in your case it would probably be 60.
I'm doing the same with my forum bec I find this a god idea however I can seem to find "search" any of the above in my sources/subs-post.php file... maybe im missing it but heres my entire sources/subs-post.php file...

Edit : tried to post my file but it says I exceed the character limit for a post... but the fact remains I still cant find the above quoted items in my file...
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


codenaught

Hmmm.... not sure why it seems to be different from before  :-\, but instead of searching for that, search for:

if ($func['strlen']($_POST['evtitle']) > 30)
$_POST['evtitle'] = $func['substr']($_POST['evtitle'], 0, 30);
Dev Consultant
Former SMF Doc Coordinator

MoreBloodWine

#11
Quote from: akabugeyes on October 15, 2006, 08:58:00 PM
Hmmm.... not sure why it seems to be different from before  :-\, but instead of searching for that, search for:

if ($func['strlen']($_POST['evtitle']) > 30)
$_POST['evtitle'] = $func['substr']($_POST['evtitle'], 0, 30);

Maybe I couldnt find it before bec my version is 1.1 RC3 which I forgot to mention but I found it now and changed both instances of 30 to suit my needs but I do have a question but first look at the pic below...



Under both Birthdays and Events how can I get the first of each to drop down so it evens out wih the other sorted items... hope it this makes sense... but I want everything to look "uniformed / in order"... so the question is out of all your above references codes to get me this far what needs to be changed...
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


codenaught

Before each of the following add echo ' <br />';

foreach ($context['calendar_birthdays'] as $member)

foreach ($context['calendar_events'] as $event)
Dev Consultant
Former SMF Doc Coordinator

MoreBloodWine

I updatd the pic above to show you your a genius hehe... thx man... i know that was kind of a weird request for most but hey why have a forum if u cant have it al in order hehe... Thx man. but one other thing not that it matters to much but how would put a break <br> between the last birthday and the word(s) Upcoming events: this way no matter how many birthdays you have you'll always have a space / break between the last birthday and Upcoming Events:
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


codenaught

For that, find:

if (!empty($context['calendar_events']))
{
echo '


Change to:


if (!empty($context['calendar_events']))
{
echo ' <br />
Dev Consultant
Former SMF Doc Coordinator

NEMINI

thanks for all the info akabugeyes.  I'll be adding this to my site when I go live with it :)  This might make a good mod ;)
signatures are boring.

MoreBloodWine

#16
Thx aka... couldnt have done any of this without you and the starter of this thread for bringing up this wonderful idea , hehe... Now to think of what I wana improve next on my forum hehe...

Edit : If I wanted to underline which I know how to do , thats the easy part hehe... but if I wanted to underline both Upcoming Birthdays:  &  Upcoming Events: what file would I look in I cant seem to find it in any of the files I've looked at by searching for ( Upcoming Birthdays:  &  Upcoming events: )

Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


codenaught

Glad to have been able to help. :)

For the underline, in BoardIndex.template.php,

Find:

<span style="color: #', $modSettings['cal_bdaycolor'], ';">', $context['calendar_only_today'] ? $txt['calendar3'] : $txt['calendar3b'], '</span> ';

Change to:

<span style="color: #', $modSettings['cal_bdaycolor'], '; text-decoration: underline;">', $context['calendar_only_today'] ? $txt['calendar3'] : $txt['calendar3b'], '</span> ';


Find:

<span style="color: #', $modSettings['cal_eventcolor'], ';">', $context['calendar_only_today'] ? $txt['calendar4'] : $txt['calendar4b'], '</span> ';

Change to:

<span style="color: #', $modSettings['cal_eventcolor'], '; text-decoration: underline;">', $context['calendar_only_today'] ? $txt['calendar4'] : $txt['calendar4b'], '</span> ';
Dev Consultant
Former SMF Doc Coordinator

MoreBloodWine

#18


Ok , your prolly tired of all this praising but you are a godsend aka... ty soooooooo much for everything this now completes my entire wana do list... all I need done now is someone to pick up my mod request and then all I will have to do is implent all the changes from this thread ive already made which will make things even funner as there will be "new" code to search for and modify which I dread but will enjoy when its done and over with hehe...
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


MoreBloodWine

#19
Hey aka got another one for ya... surprised I didnt consider it before...



All the other stuff is aligned as expected thx to you and the code modifications , but see the holidays... How can I align them by date like the other stuff below and how would I go about adding Upcoming Holidays: like there is for Upcoming Birthdays: & Upcoming Events: ???

Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Advertisement: