Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#91 2005-12-09 16:55:14

rbl
Member
From: Portugal
Registered: 2004-02-25
Posts: 40

Re: [plugin] [ORPHAN] mdp_calendar

Bump

Offline

#92 2006-01-09 21:07:17

jessejericho
Member
Registered: 2005-10-29
Posts: 25

Re: [plugin] [ORPHAN] mdp_calendar

Could someone give me a hand with styling the calendar? I would like to be able to control the placement of the day numbers, as well as the size and line height of the event text. I’m having trouble figuring this out from the help file. Even if you could just post the CSS you are using to style yours, that would be appreciated. Thanks!

Offline

#93 2006-01-11 17:35:46

rloaderro
Archived Plugin Author
From: Costa Rica
Registered: 2006-01-05
Posts: 190
Website

Re: [plugin] [ORPHAN] mdp_calendar

Working on a small theater website (music, drama, etc..), I wanted a small calendar to supplement the events navigation – similar to the one here

These are some of the problems I encountered:
  • Single letter month abbreviations
  • Adding “cellpadding=0 cellspacing=0” to the table tag for the element to render properly in all browsers
  • Multiple dates for events (articles)
Note: My solutions make some assumptions:
  • Small calendar natch (ie.. your calendar tag looks something like this: <txp:mdp_calendar_small displayfuture=“1” dayformat=“ABBR” />)
  • Clean URLs presented as “section/article” or “article” ONLY
  • All the solutions involved editing ver 0.5 of the plugin (Admin > Plugins > mdp_calendar > Edit)

A final warning – I know close to nothing about PHP – Alrighty, here we go:

Single (or however many) letter month names

1. Find the function “dspDayNames”
2. Find this line “$c[] = ‘<th>’.$names[$i].”</th>”;”
3. Use PHP’s substring function to abbreviate the names further. Replace the line with the following for 1 letter abbreviations:

$c[] = ‘<th>’.substr($names[$i], 0, 1).”</th>”;

Adding “cellpadding=0 cellspacing=0” to the table tag

Without cellpadding/cellspacing the table almost invariably renders with gaps between the cells regardless of how the CSS is styled – not very pretty if you are going for a classic outlined calendar.

1. Find function “display” (the first instance in the plugin, this function replaces the instance further down in the script)
2. In order to add these atributes we can’t use Textpattern’s built in tag builder (doTag). Replace the function as follows:

function display($static=false, $future=false) { $id = ($this->tableID) ? ‘ id=”’.$this->tableID.’”’ : ‘’; $c[] = ‘<table’.$id.’ cellpadding=“0” cellspacing=“0”>’; $c[] = $this->dspHeader($static, $future); $c[] = $this->dspDayNames(); $c[] = $this->dspDayCells(); $c[] = ‘</table>’; return join(‘’,$c);
}

Multiple dates for articles

This is a tricky one – my solution may not work for everyone (URLs cannot contain different dates or unique ID’s / only 1 event per day will be displayed). However, this was important where a single event might play 2, 10 or however many showtimes (and not sequentially either!) – and the calendar would be misleading if it only showed a single instance.

1. Firstly, it’s important how the content is written. The article representing the event should have the “Posted” date of the last showtime of the event (preferably at 23:59 at night as well so it remains posted throughout the final day). This is handy if you have the current event on your homepage for example (as mentioned to me by “nardo” on IRC (textpattern@ freenode – the unofficial/official Textpattern forum) so that it drops off after all the event showtimes have passed.
2. Write additional articles for the same event setting the posted date for each one of the showtimes. The only fields that should be completed are the “Title”, “Posted” and “URL-only title” (under Advanced Options – ALL the articles must share the same URL – Textpattern will warn you with a message like “The same URL-only title is used by x different articles”) – that’s OK). Additionally you can set the Sections & Categories as required.
3. Be sure to set the “Status” for these additional article/showtimes to “Hidden” – this way they will show up on the Calendar but nowhere else in your TXP site.
4. In the plugin, find the function “mdp_calendar_getEvents”
5. We need to find the “Hidden” events, so look for the line starting “$sql = “. Replace “Status = ‘4’” with “(Status = ‘4’ OR Status = ‘2’). If you test your calendar now the events should all appear properly – but the links don’t work.
6. Find “class MDP_Small_Calendar”. We won’t modify the code here, so if you ever won’t to return to the default calendar functionality you only need to remove the additions we’re abou to make. In the funtion “dspDayCell” on a new line BELOW where the $title variable is defined, add this code:

$days_events = $this->events[$day];
extract($days_events[0]);
$href = ‘ href=”’.$link.’”’;
$title = ‘ title=”’.$title.’”’;

NOTE: I just take the first article from the array for the day ($days_events[0]) – if there are multiple events for the day, only the first event will be linked to.

The result of all this – assuming I haven’t forgotten anything – is that all the showtimes to your events appear on the calendar and all link to the same article. If anyone has any problems with these instructions or better ideas please feel free to message me. Or if anyone would like the modified plug-in directly. As soon as I have the site online I will post a link so the result is easily appreciated!! -Hasta rl


Travel Atlas * Org | Start Somewhere

Offline

#94 2006-01-12 23:15:03

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: [plugin] [ORPHAN] mdp_calendar

My small calendar is not working properly. Links off the small calendar sometimes lead to empty pages. I kind of know why, and it’s a timezone issue.

My timezone is GMT-0800. If I set an event for Jan 15 at 16:00 hours. It will load the article in the previous day’s url, ie http://c2design.info/diversity/?month=2006-01-14, however if I set the event time for Jan 15 at 15:59 hours it works as expected. As 16:00 is eight hours less than 24:00. It has to be an offset issue.

Anyone know of a fix for this?

Offline

#95 2006-01-20 17:21:37

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: [plugin] [ORPHAN] mdp_calendar

Does the small calendar always output a list or articles rather than a single article even if there is only one article in the list?

Offline

#96 2006-01-20 17:37:36

rloaderro
Archived Plugin Author
From: Costa Rica
Registered: 2006-01-05
Posts: 190
Website

Re: [plugin] [ORPHAN] mdp_calendar

Does the small calendar always output a list or articles rather than a single article even if there is only one article in the list?

Yes :)


Travel Atlas * Org | Start Somewhere

Offline

#97 2006-01-20 17:39:39

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: [plugin] [ORPHAN] mdp_calendar

Is there any way to get around this with conditionals?

Offline

#98 2006-01-20 18:11:09

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: [plugin] [ORPHAN] mdp_calendar

Greenrift> It would be nice to add a tag called “time” and have it accept “any” “future” or “past” like the article tag.

I have a project where my article form will display only future events, while the callendar will display all.

Last edited by mrdale (2006-01-20 18:16:23)

Offline

#99 2006-02-07 12:16:33

Nonsense
Member
Registered: 2005-11-25
Posts: 53

Re: [plugin] [ORPHAN] mdp_calendar

I’ve got some wierd problems.

First of all the “alt” tag displays the wrong date when I place the cursor over an event in the calendar.
If the event takes place 22 feb it states 23 feb. Huh?
The date in the calendar is right but, the “hover” date is wrong.

And then there’s anther thing bugging me. Doesn’t the tag “ form=“whatever” “ work with mdp_calendar?
When I click on a date in the calendar the article is displayed as listform and not form.

BTW I agree with mrdale a additional tag which states time would be useful.

Thanks for a good plugin.

Offline

#100 2006-03-02 13:44:55

khellstr
Member
From: Helsinki, Finland
Registered: 2006-02-16
Posts: 12
Website

Re: [plugin] [ORPHAN] mdp_calendar

Hi
I’m working with small theatre site and I want to have a calendar which highlights the show dates as in picture below. The thing is I don’t want/need any links or relations to articles, just day’s highlighted.

How I think it could work, is that I have customfield showdays and end-user insert something like march06(8,12,21,22,25),April06(8,12,21,22,25)… to the customfield. And the plugin would parse out array and render calendar(s).

I don’t know if this is right approach to this problem, or should i find some simplier php calendar and try to make txp plugin from it. (I have no idea yet how to do that). I know php very(very) little, but I suppose getting showdates in array instead of finding articles would not be big problem. I just don’t have any idea how get customfield(or any) variable to php code and how to parse it right. Bigger problem could be how to make plugin render multiple calendars depending on which month there is a showdate. and.. and..

I would be very thankful If someone gives me some advice.

Offline

#101 2006-03-05 22:43:53

greenrift
Archived Plugin Author
Registered: 2004-03-08
Posts: 186
Website

Re: [plugin] [ORPHAN] mdp_calendar

I’ve updated the version 1.0. I’m hoping that everything will work as it should.

mdp_calendar

  • Bug Fix: The time zone and offset problems should be taken care of.
  • Change: The “time” attribute has been added, you can use it to control which articles should be displayed. “any”, “past” (default), and “future” are the possible values.
  • Update: If when using the small calendar you are getting an empty list after clicking on a day, check that you set the “time” attribute of the txp:article tag to “any”. You might need to use some conditional statements to get this to work as you really want.

Again, keep me updated if something doesn’t work out right. I do keep tabs on this stuff, just not committing as much time as I used to.

Last edited by greenrift (2006-03-08 20:26:23)

Offline

#102 2006-03-08 19:32:38

chariscomp
Member
Registered: 2006-03-02
Posts: 14

Re: [plugin] [ORPHAN] mdp_calendar

Hello,

I am using your great plugin on my church’s website at http://www.sobc.info. I have a feature request, though. It would be really great if it was possible to specify some extra markup to be used for a given category or list of categories. I.e. I have some birthday events on the calendar; I also have some regular events. I have the birthday events all created with a category of birthday. It would be great if I could do something like:
<code>
<txp:mdp_calendar_large section=“events” id=“main_calendar” displayfuture=“1”>
<txp:mdp_calendar_category name=“birthdays” wraptag=“span” class=“birthday” />
<txp:mdp_calendar_category name=“regular” wraptag=“span” class=“regular” />
</txp:mdp_calendar_large>
</code>

Where name=name of category, class=css class and wraptag=tag to be used to wrap link in

What I am trying to do would be to have different ways of displaying the links depending on category. It would also be nice if I could add a small image or icon depending on category. I guess that could be done with the class and CSS styling.

I also wish there was some way to handle multi-day events. I read one post on a way to do it, but wondered if this has made it into the main plugin or if you are considering something different.

Also, I wanted to have a list of all events underneath the calendar that would follow along with the calendar. I was able to do this with some php code. I am posting it here in case it helps someone else.
<code>
<txp:php>
$vars=array();
$vars=$GLOBALS[“_GET”];
$month=$vars[“m”];
$year=$vars[“y”];
if (strlen($month)==1) {
$month=“0”.$month;
}
echo “<txp:chh_article_custom limit=99999 form=‘event_single’ listform=‘event_main’ section=‘events’ month=’$year-$month’ time=‘any’ sortdir=‘asc’ />”;
</txp:php>
</code>

Basically, this code creates a txp:chh_article_custom tag that pulls the month and year from the URL in the same way this plugin does. You can see it in action at http://sobc.info/events

I appreciate all you are doing with this. Let me know if I can help on any of this. I have some PHP experience. I might even have a go at adding support for the first feature request. Let me know what you think.

Last edited by chariscomp (2006-03-08 19:33:55)

Offline

#103 2006-03-31 20:00:27

ragger
Member
From: Netherlands
Registered: 2005-04-10
Posts: 87
Website

Re: [plugin] [ORPHAN] mdp_calendar

Nice plugin!

Two problems though:

  • Link hover shows date plus 1 ( …title=”*31*-03-06”>*30*</a> ).
  • Following a datelink leads to the right article, but comments / commentform are gone.

Hmm, I hope I made myself clear :) Otherwise check my site
TIA.

Last edited by ragger (2006-03-31 20:30:07)

Offline

Board footer

Powered by FluxBB