Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#817 2012-12-20 14:33:26

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 553

Re: smd_calendar: complete schedule / event / calendar / diary

Okay, now I’m confused. It appears that I’ve already defined the Year as a variable and upon further investigation I see that any link (not just links on the mini calendar) that change the calendars view switches the mini calendar back to 2012.

This is the entire contents of my variables form:

<!-- If on the homepage use the default section else use the sections name for the section -->
<txp:variable name="this_section"><txp:if_section name="default"><txp:else /><txp:section /></txp:if_section></txp:variable>
<!-- Setup the dateURL variable -->
<txp:variable name="dateURL">
	<txp:smd_cal_now format="&amp;date=%Y-%m-%d&amp;day=%e&amp;weekday=%A&amp;month-name=%B&amp;year=%Y&amp;month-num=%m" now='<txp:variable name="date" />' />
</txp:variable>
<!-- Grab variable values from the URL (used when a date is click on in the mini calendar) -->
<txp:adi_gps name="date" quiet="1" />
<txp:adi_gps name="day" quiet="1" />
<txp:adi_gps name="weekday" quiet="1" />
<txp:adi_gps name="month-name" quiet="1" />
<txp:adi_gps name="month-num" quiet="1" />
<txp:adi_gps name="year" quiet="1" />
<txp:adi_gps name="view" quiet="1" />
<!-- Set default values for the variables -->
<txp:php>
	global $variable;
	if (empty($variable['date'])) $variable['date'] = date('Y-m-d');
	if (empty($variable['day'])) $variable['day'] = date('j');
	if (empty($variable['weekday'])) $variable['weekday'] = date('l');
	if (empty($variable['month-name'])) $variable['month-name'] = date('F');
	if (empty($variable['month-num'])) $variable['month-num'] = date('n');
	if (empty($variable['year'])) $variable['year'] = date('Y');
	if (empty($variable['view'])) $variable['view'] = 'day';
</txp:php>
<txp:variable name="isoweek"><txp:smd_cal_now format="%V" now='<txp:variable name="date" />' /></txp:variable>

Here’s how I’m outputting the mini calendar complete with links:

<txp:if_section name="default">
<txp:variable name="calendar_section" value="" />
<txp:else />
<txp:variable name="calendar_section"><txp:section /></txp:variable>
</txp:if_section>
<txp:if_category>
<txp:variable name="calendar_category">&amp;c=<txp:category /></txp:variable>
<txp:else />
<txp:variable name="calendar_category" value="" />
</txp:if_category>
<txp:smd_if_cal flag="SMD_ANY">
<a href="<txp:site_url />?s=<txp:variable name="calendar_section" /><txp:variable name="calendar_category" />&amp;view=day&amp;date={year}-{monthzeros}-{dayzeros}&amp;day={day}&amp;weekday={weekdayfull}&amp;month-name={monthname}&amp;year={year}&amp;month-num={month}">{day}</a>
<txp:else />
{day}
</txp:smd_if_cal>

Here’s the URL I get when clicking on the 9th January 2013 from the mini calendar.

www.sitename.com/?s=&view=day&date=2013-01-09&day=9&weekday=Wednesday&month-name=January&year=2013&month-num=1

Last edited by Algaris (2012-12-20 14:36:55)

Offline

#818 2012-12-20 15:18:02

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 553

Re: smd_calendar: complete schedule / event / calendar / diary

I’ve managed to get it working! All I had to do was add year='<txp:variable name="year" />' to the
smd_calendar tag.

Thanks for making such a wonderful plugin Stef.

Last edited by Algaris (2012-12-20 15:18:35)

Offline

#819 2013-03-06 12:14:30

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: smd_calendar: complete schedule / event / calendar / diary

Hi Stef,

I’m hitting a problem when specifying two or more categories, e.g:

<txp:smd_calendar section="noticeboard" category="event,all-day-event"> ... </txp:smd_calendar>

In other words, I’m interested in entries for the calendar that all belong to the section “noticeboard” but are only associated with categories “event” or “all-day-event”.

The current month calendar comes up OK, but the prev/next links just give me blank pages.

The prev link is: http:// ... /?c=event,all-day-event&m=2&y=2013

If I remove “event” or “all-day-event” from the URL list the page is displayed.

Still no joy if I remove section=“noticeboard” from the smd_calendar tag.

Any clues to what I’m doing wrong would be most welcome.

Offline

#820 2013-03-06 22:25:07

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,449
Website GitHub

Re: smd_calendar: complete schedule / event / calendar / diary

gomedia wrote:

The prev link is: http:// ... /?c=event,all-day-event&m=2&y=2013

Bah! Shoddy code on my part. Forgot that category and section could take multiple values and just stuffed them in the URL verbatim.

Leaves me with a dilemma of how to handle that situation because I don’t think the URL can support more than one, even if I sent them as an array. Wonder what the effect is if I just take the first one and use it in the link. Would it impact the page logic in any way?

Hmmmmmm. Ideas on a postcard to the usual address…

Last edited by Bloke (2013-03-06 22:26:15)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#821 2013-03-06 23:00:30

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: smd_calendar: complete schedule / event / calendar / diary

Bloke wrote:

Hmmmmmm. Ideas on a postcard to the usual address…

Thanks for the reply.

I noticed that the section didn’t even get a mention in the URL (it’s different to the section where the calendar is sitting), so I’m guessing this is a TXP URL article retrieval job as opposed to a built-in query by the plugin.

I can only think of a workaround to make it do what I want – which is basically to put all the different categories of interest (there’s actually more than two in play) under one category parent, have that specified in the smd_calendar ‘category’ attribute & then filter out the articles using if_article_category within the smd_calendar form. Haven’t tried it in anger yet though, but I’m hopeful. It won’t be as efficient – but needs must when the client drives!

Offline

#822 2013-06-06 14:46:59

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

Re: smd_calendar: complete schedule / event / calendar / diary

Hi folks, I’m new to smd_calendar and am trying to figure out how to maintain the month selected if I select a category from a txp:category_list

It works fine if I select the category first and then change month as smd_cal appends the date onto the end of the category string but the category_list links reset everything back to current month.

How can I carry the dates over when I select a category from the category_list?

Offline

#823 2013-06-21 08:43:13

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,449
Website GitHub

Re: smd_calendar: complete schedule / event / calendar / diary

damienbuckley wrote:

How can I carry the dates over when I select a category from the category_list?

Unfortunately, as you found, category_list wipes any extra URL variables. I would expect the only solution is to roll your own category_list container so you build up the link manually. Something like this (untested):

<txp:smd_calendar>
   <txp:variable name="curr_month"><txp:smd_cal_info type="month" /></txp:variable>
   ...
</txp:smd_calendar>

...

<txp:category_list wraptag="ul" break="">
   <li>
      <a href="/category/<txp:category /><txp:if_variable name="curr_month">?m=<txp:variable name="curr_month" /></txp:if_variable>"><txp:category title="1" /></a>
   </li>
</txp:category_list>

I think that should work. Essentially you’re just making a note of the current month in a txp:variable and then when you get to display your category list, you read that value back and construct an anchor which includes that value.

This approach won’t work if your category_list appears before your calendar tag. If there’s no way to rearrange your page flow to achieve this then you have a couple of options. Firstly, employ something like adi_gps to read the value of the m URL variable just before your category_list tag. Stash it in the same txp:variable as in the calendar tag I gave above, and then the category_list code I posted will continue to work. Otherwise, you’re probably into jQuery territory to inject the month into the anchor after the DOM has loaded. Bit messy.

Hope that helps.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#824 2013-06-21 09:13:42

etc
Developer
Registered: 2010-11-11
Posts: 5,194
Website GitHub

Re: smd_calendar: complete schedule / event / calendar / diary

etc_url does exactly what you need: create/modify a TXP url. That should work:

<txp:category_list wraptag="ul" break="li">
      <txp:etc_url url="" query='id&c=<txp:category />'><txp:category title="1" /></txp:etc_url>
</txp:category_list>

Offline

#825 2013-07-16 06:50:01

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

Re: smd_calendar: complete schedule / event / calendar / diary

Sorry folks, forgot to subscribe to the thread…

Thanks for these suggestions. I’ll give them a whirl.

I have another query – is it possible to repeat events on certain weekdays? i.e. a course which is ran on Friday, Saturday and Sunday every week? I’ve tried all sorts of repeat combinations with no success. I know the alternative is to enter the event for the three days and repeat weekly but just thought I’d ask if there was a way to do it with one article entry?

Offline

#826 2013-08-06 02:14:30

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

Re: smd_calendar: complete schedule / event / calendar / diary

I’m getting an odd result with smd_cal. I have this snippet:-

<txp:smd_calendar form="zem_event_list" section="events" navarrow="&laquo;,&raquo;" class="zem_event_calendar" classprefixes="" navclass="prev,next" category='<txp:category />' stepfield="custom_1" omitfield="custom_7" classlevels="cell" select="month, year" selectbtn="Go" maintain="section"/>

The calendar displays with Saturday as the first day of the week and the dates are out by one day i.e. it shows the 1st of August 2013 as Wednesday when it should be Thursday.

If I add this dayformat="{Sun,Mon,Tue,Wed,Thu,Fri,Sat}" the calendar shows correctly. Adding and changing the firstday= parameter had no effect at all.

I’ve checked in TXP diagnostics and the Server TZ is showing as ‘America/New York’ but I have TXP set (correctly) to Australia/Brisbane.

Is the Server TZ the problem or is there an issue with the plugin?

The other two sites I’m using smd_calendar on aren’t having this problem though they are on different servers…

Offline

#827 2013-08-06 09:30:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,449
Website GitHub

Re: smd_calendar: complete schedule / event / calendar / diary

damienbuckley wrote:

The calendar displays with Saturday as the first day of the week and the dates are out by one day

Does it do the same if you use the beta v0.53 ? I think I fixed all these weird date shifting issues but if there are any more I’ve missed in the latest version, please get back to me.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#828 2013-08-06 09:35:24

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

Re: smd_calendar: complete schedule / event / calendar / diary

I found & installed the beta after posting. It looks ok at the moment but I’ll keep an eye on it over the next couple of days and post back

Offline

Board footer

Powered by FluxBB