Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#511 2010-04-03 02:58:36
Re: smd_calendar: complete schedule / event / calendar / diary
Awesome and beautiful work, Kevin.
smd_calendar is an amazing thing too.
Tricky thing that issue you want to fix, aligning those spanned events…
Certainly, this doesn’t seem a job for CSS, not for using transparent placeholders. It seems that the only way would be to create/program some kind of time grid (using …errr… tables or maybe alls) inside each daily cell, and render an event on its corresponding row time.
Another path could be to count how many events were rendered on the previous cell, and try to do something with that info, but that would seem hackish.
Also, there is at least one case that it’s not represented in the current May calendar: when you have an spanned event (for example, a 4-days long event) and, for example, on the 3rd or 4th day you have one even earlier than the spanned one.
I hope you or Stef find a clever solution.
In the meanwhile, a visual aid to help the eyes following broken spanned events could be using a few different colors for each event.
The easiest way to achieve this is probably by using a custom field and manually assigning a color to each event. Or maybe you can find a way to do it randomly and programmatically fetching the colors from a limited list of allowed colors. But again, it maybe tricky to make “broken spanned events” to render the same color on each cell…
Offline
#512 2010-04-03 03:07:45
- kevinpotts
- Member

- From: Ghost Coast
- Registered: 2004-12-07
- Posts: 370
Re: smd_calendar: complete schedule / event / calendar / diary
Awesome and beautiful work, Kevin.
Thank you. It’s a work in progress. These are the types of bugs that are starting to appear.
It seems that the only way would be to create/program some kind of time grid (using …errr… tables or maybe alls) inside each daily cell, and render an event on its corresponding row time. Another path could be to count how many events were rendered on the previous cell, and try to do something with that info, but that would seem hackish
I thought about this, but it’s essentially the same solution. At some point, something has to count something else and react accordingly. I actually think jQuery could do this, but that level of development is miles beyond me. It’s certainly not impossible; Google Calendar and others managed to figure it out at some point. With all that in mind, having transparent placeholders made a lot of sense because it doesn’t really break anything. And it would be perfect, except for the fact that spanned events do not respect other events’ start time within the same day; they seem to be laid in by article ID and that’s that. I’ll continue to plug away at it.
UPDATE: OK, I’ve turned this plugin inside and out, and there does not seem to a way to force this out of the box. Stef, this could be solved one of two ways:
- Create a
sortattribute for<txp:smd_calendar />like there is for<txp:smd_article_event />to explicitly control the ordering of events inside a day’s cell. - Add a
timeattribute to<txp:smd_if_cal>so I can sniff if my transparent placeholder falls within a specific time so it renders first.
Hope that makes sense.
Last edited by kevinpotts (2010-04-03 03:40:42)
Kevin
(graphicpush)
Offline
#513 2010-04-03 21:57:20
Re: smd_calendar: complete schedule / event / calendar / diary
kevinpotts wrote:
Add a
timeattribute to<txp:smd_if_cal>so I can sniff if my transparent placeholder falls within a specific time
The next version is better at time handling so you’ll be able to do this.
Create a
sortattribute for<txp:smd_calendar />like there is for<txp:smd_article_event />to explicitly control the ordering of events inside a day’s cell
You could try modding the plugin a little. I’m not convinced it’ll achieve what you want in this simplistic form, but if you want to try it:
1) In this block at the very top of the plugin:
extract(lAtts(array(
'time' => 'any',
'size' => 'large',
'expired' => '',
...
add a sort attribute to the list, like this:
'sort' => 'Posted asc',
2) Search the plugin for this line (around line 270ish I think):
$sql2 = $stati . " HAVING uPosted <= ".$ts_last . $expired . $extrasql ." ORDER BY Posted ASC";
and change it to this:
$sql2 = $stati . " HAVING uPosted <= ".$ts_last . $expired . $extrasql ." ORDER BY $sort";
That’ll pull out all events in the order you give via the sort attribute, though I don’t know if it’ll help because it might need to be more clever than that to order them on a per-cell basis. You can try and let me know how it goes if you don’t mind.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#514 2010-04-04 12:57:05
- kevinpotts
- Member

- From: Ghost Coast
- Registered: 2004-12-07
- Posts: 370
Re: smd_calendar: complete schedule / event / calendar / diary
Stef —
You are one of the smartest guys I’ve never met. Your quick’n‘dirty patch proved most effective, but not how I expected. First of all, changing those two bits of code enables the sort attribute perfectly as if I were using the <txp:article /> tag or something. HOWEVER, the sorting within a cell still does not completely respect the Posted time. I have no idea why. I changed it to sort="LastMod asc" and it worked perfectly, as expected. Go figure.
With the sorting working but the Posted time still acting all wonky, I had to resort to less elegant tactics. I added a custom field called “sort”. Every “real” event and every “placeholder” event is assigned a number from 01-05, which dictates, obviously, the order in which they appear inside the day’s cell. Then placeholder events are given a category of “placeholder”, which, through the magical and wonderful code of your plugin, results in class of smd_cal_ev_placeholder applied to the spanning element. Then I simply added this bit to the CSS:
#cal td.smd_cal_event span.smd_cal_ev_placeholder a { visibility: hidden; }
visibility: hidden; respects the block element’s width and height, but simply hides it, creating a nice blank area that pushes everything else down.
So in the end, your patch worked perfectly, and my placeholders are correctly pushing “broken” events into place. You can see the nicely aligned events here.
Stef, thank you. I’ve said this before and I am sure I will say it again, but your plugins are so ridiculously powerful and scalable that they are pretty much systems unto themselves. smd_calendar and smd_gallery are amazing to play with.
Last edited by kevinpotts (2010-04-04 12:59:25)
Kevin
(graphicpush)
Offline
#515 2010-04-27 02:19:11
- andocobo
- New Member
- Registered: 2010-04-27
- Posts: 2
Re: smd_calendar: complete schedule / event / calendar / diary
Hi Stef,
Firstly, I’ve used many of your plugins in the past and I appreciate the great work you’ve done for the txp community very much…i don’t know how you find the time to do it all. Secondly, I’ve got an issue with smd_article_event, when i use it i get the following error message:
Tag error: <txp:smd_article_event datefields="datefield" sort="posted desc" time="any" limit="1" form="nextEvent" category="events" /> -> Warning: array_multisort() [function.array-multisort]: Argument #1 is expected to be an array or a sort flag on line 1
I am using the tag thusly in the page template:
<txp:smd_article_event datefields="datefield" sort="posted desc" time="any" limit="1" form="nextEvent" category="events" />
And the form it is calling has the following code:
<h5><txp:custom_field name="city" /> - <txp:custom_field name="datefield" /></h5>
<p><txp:title /></p>
<a href="<txp:permlink />">Learn more about this event »</a>
I hope you can help me out, this problem is driving me crazy.
Thanks!
Offline
#516 2010-05-04 03:31:20
Re: smd_calendar: complete schedule / event / calendar / diary
Hi Bloke,
I just came across your smd_calendar plug-in. I’m sure I’ll be able to use it (nonprofit/charity groups are full of events!) But, unfortunately, I’m not getting the Article tag thing.
On your posting #8 you state the following quite clearly as part of your “Quick Start Demo:
◦Install the plugin [which I’ve done]
◦Make a section called something like events [done]
◦In your page template for that section, add <txp:smd_calendar section=“events” /> [done.]
◦Go and create some articles in the events section, set the dates to whenever you want those events to occur [Huh?]
◦View yoursite.com/events
As you can see, I’ve done the above. The calendar views with a link the Article, along with a copy of that item below the Calendar. However, it lists the event date as today (when I created this article). So, how would I tag it so the event date be the actual event date (e.g.: 10 June 2010).
I’m sure it has to do with the fact that I don’t know how to “set the dates to whenever you want those events to occur”. Could you provide me with an example of tags to use on my Article?
Thanks so much for your great product.
I’m not worthy.
Last edited by laptophobo (2010-05-04 04:07:45)
Living the Location-Independent Life: www.NuNomad.com
Offline
#517 2010-05-04 04:11:51
Re: smd_calendar: complete schedule / event / calendar / diary
Oops. I found my problem (with the above). I needed to change the “Published at” date within the Article.
Sorry for the false alarm.
Living the Location-Independent Life: www.NuNomad.com
Offline
#518 2010-05-04 05:53:11
Re: smd_calendar: complete schedule / event / calendar / diary
Oops. I found my problem (with the above). I needed to change the “Published at” date within the Article.
Sorry for the false alarm.
Living the Location-Independent Life: www.NuNomad.com
Offline
#519 2010-05-04 08:52:11
Re: smd_calendar: complete schedule / event / calendar / diary
Hello Stef,
Great calendar you’ve created. I’ve spent most of today tyring to understand the various attributes. For now, I’m using the default tags with only the title tag:
<txp:smd_calendar size=“small” section=“calendar”>
<div>
<txp:permlink class=“txtSmCalendar”><txp:title /></txp:permlink>
</div>
</txp:smd_calendar>
As you know, this produces a basic calendar with the tilte pushing the next date out in such a way that it looks visually awkward. I’d like to change the layout a bit to accommodate the Title info. That said, do you have an example of how I could convert the default layout to stacked (horizontal) dates? (Example: The calendar would begin with May 01, then under it will be another horizontal field for May 02, under that May 03, et cetera.)
Thanks much!
Last edited by laptophobo (2010-05-04 08:52:55)
Living the Location-Independent Life: www.NuNomad.com
Offline
#520 2010-05-04 09:15:31
Re: smd_calendar: complete schedule / event / calendar / diary
laptophobo wrote:
do you have an example of how I could convert the default layout to stacked (horizontal) dates?
The current calendar is limited to being in table format (I’m trying to make the next version more flexible in terms of layout) so if you can’t alter it with CSS then I’m afraid you’re stuck.
However, you can perhaps cheat a bit. <txp:smd_article_events /> lists all events based on the criteria you give it. With some clever use of the tag attributes and <txp:if_different> (I think there are some examples either in the plugin help or this thread) you might be able to output your events as a list and use CSS to mark it up so it looks how you want.
Does that get you started?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#521 2010-05-05 03:36:28
Re: smd_calendar: complete schedule / event / calendar / diary
Hi Stef!,
I’ll look again into your plugin help (there were a couple of examples near the bottom that I had not tried). You then mentioned above to follow “this thread,” but no thread link was provided.
Right now the (default) calendar does not look bad at all. I’d like to contain it better though. Perhaps give it a fixed size, maybe add some borders? Also, the main visual problem is that the Title that views on the calendar does not have line breaks. So, my 5 word title remains a wide horizontal area of text that pushes the next calendar number way out of position. That said, is there a tag I could use to break up the Title line? And, how might I modify the Table and Cells? (I’m pretty good with CSS.)
Thank you, once again. (Sorry for pestering you.)
Living the Location-Independent Life: www.NuNomad.com
Offline
#522 2010-05-05 08:06:10
Re: smd_calendar: complete schedule / event / calendar / diary
laptophobo wrote:
You then mentioned above to follow “this thread,” but no thread link was provided.
Because I meant this (smd_calendar) thread :-)
my 5 word title remains a wide horizontal area of text that pushes the next calendar number way out of position.
Can you limit the width of your td cells via CSS so the title wraps? (I’ve never tried) Or give your titles a class and change the font-size ;-)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#523 2010-05-07 14:25:34
- pafruu
- Member

- From: New Brunswick, Canada
- Registered: 2010-01-14
- Posts: 65
Re: smd_calendar: complete schedule / event / calendar / diary
Hello, I’m sorry if this question has been answered already!
I am trying to make this calendar work all is well until I click on the “event” to have access to more information on the event in a shape of an article or something.
I fairly new to textpattern and I know that I am missing something in the tag that I have entered. Here is what I have:
<txp:smd_calendar firstday=“0” dayformat=”{Dimanche,Lundi,Mardi,Mercredi,Jeudi,Vendredi,Samedi}” monthformat=”{Janvier,Février,Mars,Avril,Mai,Juin,Juillet,Août,Septembre,Octobre,Novembre,Décembre}” section=“spectacles” class=“calendarCell” navarrow=” , ” />
I have a feeling that I need some other tag of some sort.
Please help me
I try, and I try, and I try…. and sometimes I achieve
Offline
#524 2010-05-08 07:16:12
Re: smd_calendar: complete schedule / event / calendar / diary
Stef,
Yes, I think that modifying the TD cells with CSS may be the solution. That said, I’m wondering how.
Living the Location-Independent Life: www.NuNomad.com
Offline
#525 2010-05-11 04:29:48
Re: smd_calendar: complete schedule / event / calendar / diary
Hello Stef,
I was able to modify the table and td cells a bit using an external CSS sheet, but I’m finding myself very limited with what I can do there. When I view the Source of the HTML page, I see you have several classes (presumably CSS), e.g.: smd_cal_navrow, smd_cal_navprev, etc.
Am I permitted to modify your calendar style sheet? If so, where would it be located?
Thanks much for your time.
Last edited by laptophobo (2010-05-11 04:31:01)
Living the Location-Independent Life: www.NuNomad.com
Offline