Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#217 2009-04-15 17:38:30

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

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

I’m sure that can be done, but I’ve lost a bit what your code is at the moment ;) Can you post what you have now?

Offline

#218 2009-04-15 20:14:26

Josefin
Member
Registered: 2008-01-30
Posts: 18

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

I seems to work great! But hm.. I tried the quick home-made-demo:

* Install the plugin * Make a section called something like events * In your page template for that section, add <txp:smd_calendar section=“events” /> * Go and create some articles in the events section, set the dates to whenever you want those events to occur * View yoursite.com/events

As I understand it, I set the publish-date to when I want the event to take place, but when I set the date to say, sometime next week, the event will be clickable in the calender but wont show on the page since it hasnt been “published yet”.

And also; where do I set the ID for the calendar (calid)
I’m not used to using plugins.

/Josefin

Offline

#219 2009-04-16 09:23:16

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

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

Josefin wrote:

As I understand it, I set the publish-date to when I want the event to take place

Correct. At least, that’s one way to do it. In the latest version you can also elect a custom field to hold your ‘start’ and/or ‘end’ event dates and then use TXP’s built-in published/expires dates to post your article as normal. Look at the datefields attribute in the plugin help.

but when I set the date to say, sometime next week, the event will be clickable in the calender but wont show on the page

When you say “won’t show on the page” do you mean in a regular article list? If so then that’s correct behaviour because TXP’s <txp:article /> tag won’t list articles in the future. <txp:article_custom time="any" /> will show them, as will <txp:smd_article_events />.

When you click a ‘future’ event from the calendar it should show the article correctly though, because TXP can still ‘see’ a future Live article if you know its direct URL (which the calendar does). Does the article show up correctly in this case?

where do I set the ID for the calendar (calid)

Use the id="my_calendar_name_here" attribute of the <txp:smd_calendar /> tag.

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

#220 2009-04-16 09:28:26

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

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

Hi Els,

My form code so far is –

<h6>Upcoming <txp:category1 title="1" /></h6>
<txp:if_category>
   <txp:smd_article_event section="diary" stepfield="custom_1" skipfield="custom_2" omitfield="custom_3" extrafield="custom_4" sort="Posted,Title asc" time="future" wraptag="dl" category='<txp:category1 />' limit="10" >
        <txp:if_different>   
          <dt><txp:permlink><txp:title/></txp:permlink></dt>
        </txp:if_different>
          <dd><txp:posted /></dd>
        </txp:smd_article_event>
<txp:else />
<p>No other scheduled <txp:category1 title="1" /> at the moment.</p>
</txp:if_category>

It works fine if I remove the <txp:if_category><txp:else /></txp:if_category> container, but of course I don’t get a notice if a category is empty.

Offline

#221 2009-04-17 00:07:26

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

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

decoderltd, you could try the code below. I haven’t tested it though…

<h6>Upcoming <txp:category1 title="1" /></h6>

<txp:variable name="events_in_category" value='<txp:smd_article_event section="diary" stepfield="custom_1" skipfield="custom_2" omitfield="custom_3" extrafield="custom_4" sort="Posted,Title asc" time="future" category='<txp:category1 />' limit="1" />' />

<txp:if_variable name="events_in_category" value="">
	<p>No other scheduled <txp:category1 title="1" /> at the moment.</p>
<txp:else />
	<txp:smd_article_event section="diary" stepfield="custom_1" skipfield="custom_2" omitfield="custom_3" extrafield="custom_4" sort="Posted,Title asc" time="future" wraptag="dl" category='<txp:category1 />' limit="10">
		<txp:if_different>   
			<dt><txp:permlink><txp:title/></txp:permlink></dt>
		</txp:if_different>
		<dd><txp:posted /></dd>
	</txp:smd_article_event>
</txp:if_variable>

I think you can probably leave out all attributes except section, time, category and limit in the smd_article_event tag that is in the txp:variable tag, but I’m not sure what they do so I’ve left them in for the moment.
I haven’t had the time yet to figure out how to leave out the event that is currently being viewed, but if you need that as well, I’ll try and think of a way to do that later.

Offline

#222 2009-04-17 08:12:17

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

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

Els wrote:

I think you can probably leave out all attributes except section, time, category and limit in the smd_article_event tag that is in the txp:variable tag

Correct. Assuming you are not relying on the number of dates from a recurring event (i.e. as in this case you are just testing the existence of any event) then it is perfectly ok to leave out any custom fields or other attributes that don’t apply.

I haven’t had the time yet to figure out how to leave out the event that is currently being viewed

Hmm, that’s a good point. I thought I’d coded it so that the current event is automatically ignored if in an individual article but I may have dreamed that! If you (or anyone) finds that’s not the case then please let me know. It should be in the code, perhaps as an attribute to ignore the current article or not. Good catch, thanks.


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

#223 2009-04-17 08:22:16

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

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

Bloke wrote:

Hmm, that’s a good point. I thought I’d coded it so that the current event is automatically ignored if in an individual article but I may have dreamed that! If you (or anyone) finds that’s not the case then please let me know. It should be in the code, perhaps as an attribute to ignore the current article or not. Good catch, thanks.

That wasn’t a catch ;) I just assumed it wouldn’t ignore the current event (don’t know why…), I didn’t test my code example – didn’t even look at the plugin help… – and I’ve never used it this way myself, so probably I was completely wrong about this.

Offline

#224 2009-04-17 09:43:44

Josefin
Member
Registered: 2008-01-30
Posts: 18

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

Thanx!

Bloke wrote:

When you click a ‘future’ event from the calendar it should show the article correctly though, because TXP can still ‘see’ a future Live article if you know its direct URL (which the calendar does). Does the article show up correctly in this case?

No the future articles dont show in my main column when i click them, only past ones does. This is my code:

<div id=“mainColumn”>
<h1>Kalendarium</h1> <table width=“480” border=“0” cellspacing=“0” cellpadding=“0”> <tr> <td><txp:article form=“static_text” /></td> </tr>
</table>
</div>

<div id=“calendar”>
<txp:smd_calendar size=“small” section=“ns_kalender” id=“norra” />
</div>

I’m not a developer, so I might be asking stupid questions ;)
/J

Offline

#225 2009-04-17 10:17:56

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

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

Josefin wrote:

No the future articles dont show in my main column when i click them

Weird, it works on my test system and I’m using a standard <xtp:article /> tag. I wonder what’s different between the two systems?

To eliminate (or otherwise) the plugin, let’s try this:

  1. Create (or find) an article in your ns_kalendar section, make sure its status is Live and that its date is, say, sometime next month
  2. Save the article if you haven’t already
  3. Next to the Title textbox, hit View

Does the article show up then? Is the page URL something like http://site.com/ns_kalendar/my-article-title?

If that doens’t work, your page template is not rendering future articles for some reason. We’ll have to find out why.

However, if the above test works, go to a page with the calendar on it, navigate forward to next month and locate the article you just viewed. Hover over the link to that article and check that the URL is the same as the one we just looked at when you viewed it manually. They should match exactly. If they don’t, we need to find out why your calendar is generating different links to future articles!


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

#226 2009-04-17 10:26:29

Josefin
Member
Registered: 2008-01-30
Posts: 18

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

There we might just have it:

The calendar generates a datebased link (this event is set to take place the 29 april)
http://localhost/IBN/?date=2009-04-29&s=ns_kalender

but the article id in the article list is:
http://localhost/IBN/index.php?id=30

Colud it be something in my settings?

Offline

#227 2009-04-17 12:06:02

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

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

Josefin wrote:

The calendar generates a datebased link… http://localhost/IBN/?date=2009-04-29&s=ns_kalender

Aha! I’d overlooked that you’re using the mini calendar. In that case I think it’s down to Textpattern :-(

It does the same here, and it appears that date-based URLs will only show past articles whereas regular article links can see future articles (this feature request of mine is kind of related)

What I’m trying right now — without much success because the plugin needs some modification I think — is to simulate the layout and behaviour of the minical on a large calendar, but make the URLs like the ones on the large calendar. Can’t think of a neat way of doing it right now, so I’m trying to build one ;-)

Last edited by Bloke (2009-04-17 12:06:47)


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

#228 2009-04-17 12:14:27

Josefin
Member
Registered: 2008-01-30
Posts: 18

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

You’re absolutely right:
When I change to large calendar it works. But my calendar can only be 185px wide, so I have a problem.
Is there any way around it, or can’t the small calendar be used?

Offline

Board footer

Powered by FluxBB