Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#721 2011-06-21 01:58:02

pafruu
Member
From: New Brunswick, Canada
Registered: 2010-01-14
Posts: 65

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

hello again, I tried a couple of things but I was unsuccessfull here is the tag:

<txp:smd_calendar firstday="0" dayformat="{Sun,Mon,Tues,Wed,Thurs,Fri,Sat}" monthformat="{January,February,March,April,May,June,July,August,September,October,November,December}" section="schedule" class="calendarCell" navarrow="&nbsp;,&nbsp;" stepfield="custom_1" showall="1" 
     yearwidth="0,2" select="year, month"
     stepfield="custom_1" skipfield="custom_2"
     showskipped="1" expired="1">
   <span class="<txp:smd_cal_info join=" cal_" />">
      <txp:permlink><txp:title /></txp:permlink>
      <a href="?c=<txp:category1
         />&<txp:smd_cal_info type="s, year,
         month, calid" html="1" join_prefix=""
         />"><txp:custom_field name="Location" /></a>
   </span>
</txp:smd_calendar>

I tried the if_category statement as well and that didnt work either

(added bc. for better code display. -Els)

Last edited by els (2011-06-21 06:55:52)


I try, and I try, and I try…. and sometimes I achieve

Offline

#722 2011-06-21 08:25:49

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

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

pafruu

Thanks for posting your code. I tried your tag and got event classes displayed on the (outer) wrapped <span> tag. Hmmmm. A few notes:

  1. Check that the articles that appear on the calendar actually have a Category1 and/or Category2 set. I know it sounds obvious, but I missed that which resulted in some head scratching last night
  2. You don’t need the monthformat attribute because the default is the full month names
  3. You probably don’t need the <span> in your container because the event is automatically wrapped in a span and has the event type (smd_cal_standard, smd_cal_recur, etc) added as a class name

If you have the Firefox Firebug add-on available, have a look at a typical event cell after you’ve checked the above points and see if you can spot the event classes on the default span tag around each event. I can’t see why they’d appear on my site and not yours, but maybe there’s something different between the servers and I need to dig deeper. Do you have a URL you can share to the site in question (you can PM me if you don’t want to publish it yet).


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

#723 2011-06-21 13:13:16

pafruu
Member
From: New Brunswick, Canada
Registered: 2010-01-14
Posts: 65

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

Hello again,

Here is the link to the calendar: http://www.hubcitybrewers.com/schedule


I try, and I try, and I try…. and sometimes I achieve

Offline

#724 2011-06-21 13:19:35

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

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

pafruu

Hmmm, I can see the event classes ok:

<span class="smd_cal_standard smd_cal_ev_homegame"> <<<------- HERE!
   <span class=" cal_standard">
      <a...
   </span>
</span>

With the following CSS I was able to change the background color:

.smd_cal_ev_homegame a { background:red!important; }

What am I missing?


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

#725 2011-06-21 13:32:22

pafruu
Member
From: New Brunswick, Canada
Registered: 2010-01-14
Posts: 65

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

EUREKA!!! ok! the problem was 12 inches from my screen Thanks very much. Thats exactly what I wanted to achieve.


I try, and I try, and I try…. and sometimes I achieve

Offline

#726 2011-06-21 13:37:33

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

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

pafruu wrote:

Thanks very much. Thats exactly what I wanted to achieve.

No worries. Glad it works. Like I mentioned earlier you can probably ditch the span in your smd_calendar container since the plugin does that for you automatically so it’ll save on bytes downloaded.

Last edited by Bloke (2011-06-21 13:37:51)


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

#727 2011-06-28 21:07:10

Dimitri
Member
From: Johannesburg
Registered: 2010-10-31
Posts: 129

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

Hello Bloke.

Need a small help. I cant find the correct conditionals if all today and future entry become expired.

Check my code below… <txp:if_something> is an example what I am looking for.


		<txp:if_something>

<txp:smd_article_event section=“events” time=“today, future”> <div class=“event clearfix”> <txp:article_image width=“120” height=“0” class=“event-image” /> <div class=“event-inner”> <h2><txp:title /></h2> <p> <txp:if_expires><strong>Start: </strong></txp:if_expires> <txp:posted format=”%d %B at %H:%m” /> <br /> <txp:if_expires><strong>End: </strong><txp:expires format=”%d %B at %H:%m” /></txp:if_expires> </p> <txp:body /> </div> <div class=“clear”></div> </div> </txp:smd_article_event>

<txp:else /> <h2>No Upcoming Events, watch this space</h2> </txp:if_something>


<txp:way_too_cool />

Offline

#728 2011-06-29 04:46:44

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

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

Hi Dimitry would if_expired help?

Something like

<txp:if_expired>
your conditionals
<txp:else />
<txp:smd_article_event section="events" time="today, future">
			<div class="event clearfix">
				<txp:article_image width="120" height="0" class="event-image" />
				<div class="event-inner">
					<h2><txp:title /></h2>
					<p>
						<txp:if_expires><strong>Start: </strong></txp:if_expires>
						<txp:posted format="%d %B at %H:%m" /> <br />
						<txp:if_expires><strong>End: </strong><txp:expires format="%d %B at %H:%m" /></txp:if_expires>
                                         </p>
					<txp:body />
				</div>
				<div class="clear"></div>
			</div>
		</txp:smd_article_event>

<txp:else /> <h2>No Upcoming Events, watch this space</h2>
</txp:if_expired>


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#729 2011-06-29 05:38:33

Dimitri
Member
From: Johannesburg
Registered: 2010-10-31
Posts: 129

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

Hi Yianni
I have tried if_expired, it doesnt work

Dont forget its not an article tag. My error message is this
Tag error: <txp:if_expired> -> Textpattern Notice: Article tags cannot be used outside an article context on line 2323

I guess I have to skip <txp:smd_article_event> and use <txp:article /> instead to achieve my result


<txp:way_too_cool />

Offline

#730 2011-06-29 07:19:49

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,729
Website

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

Hi Dimitri,

if you switch to txp:article you lose the ability to use smd_calendar’s pseudo-events in the future because the expiry date relates to the first end date of an event, which may be long past although the event still repeats on into the future.

I think that smd_article_event doesn’t have an else-case but you can use trusty old txp:variable to test for future articles, something like this (untested):

<txp:variable name="upcoming_events" value='<txp:smd_article_event section="events" time="today, future">yes</txp:smd_article_event>' />
<txp:if_variable name="upcoming_events" value="">
   <h2>No Upcoming Events, watch this space</h2>
<txp:else />
   <!-- your smd_article_event code -->
</txp:if_variable>

Does that achieve what you want?


TXP Builders – finely-crafted code, design and txp

Offline

#731 2011-06-30 21:35:05

Dimitri
Member
From: Johannesburg
Registered: 2010-10-31
Posts: 129

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

Hi Jakob.

Thanx for the help, your code seems to work.

It would be great if the code you posted can work with the Expired date not the Posted date.
Any ideas? If its not possible, I can accept it.

Ps: Could you explain to me why you added “yes” in value='<txp:smd_article_event section="events" time="today, future">yes</txp:smd_article_event>'


<txp:way_too_cool />

Offline

#732 2011-07-01 06:45:26

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,729
Website

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

Could you explain to me why you added “yes” …

The thinking is (perhaps naively) that there’s a small speed improvement as there is no need for article_custom to go off and retrieve the article form and output all the fields it contains making for a big variable. As long as there are future articles, that’s all we need to know, what they contain is irrelevant… in fact the above could be optimised by adding limit="1" to the attributes. I’ve no idea if it actually makes any appreciable savings.

It would be great if the code you posted can work with the Expired date not the Posted date. Any ideas? If its not possible, I can accept it.

You mean events that straddle the today date? I couldn’t tell from the instructions whether time="today" covers that situation but it sounds like that is what should differentiate “today” from “future” or “past”. Knowing Stef he’s thought of that already so perhaps it’s worth testing first whether that works. There are also attributes named from and to that you could experiment with…

Otherwise I think that is going to be a hard one. There are various complicated-looking ideas in other threads if you search the forum, but that’s not going to help with smd_article_event because there are no real txp articles in the future, just smd_calendar’s pseudo-articles so you need to use smd_calendar’s functions.

If you don’t need a specific number of articles, another (not very efficient) approach could be to output all events including those in the past using time="any", then from within your form test whether the event’s expired date lies in the past (note: I think in this case you need the new smd_event_info for that not txp’s expired tag).


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB