Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-07-09 12:46:00

[Axel]
Member
From: Switzerland/Denmark
Registered: 2007-07-26
Posts: 65
Website

I have an event page, and need the current event at top of the list

I have an event page, that shows upcoming and past events in an article list.
They are sorted upcoming events in ascending order and under there past events in descending order.

I use two forms:

<h4>##enl_upcoming##</h4> <txp:article_custom section="events" form="events" limit="6" time="future" sort="posted asc" /> <br/><br/> <h4>##enl_past##</h4> <txp:article_custom section="events" form="events" limit="99" time="past" />

and

<div class="events-block"> <h4><txp:title /></h4> <txp:excerpt /> <txp:php> $strlen=strlen($thisarticle['body']); if($strlen !=0 ){ $link = permlink($atts=array(),"##event_full_article## »"); echo '<div class="more-link">'.$link.'</div>'; unset($link,$strlen); } </txp:php> </div>

This works fine like this, but my problem is, that I need to have at top a section with events that are running right now. I thought I could get them to show up by using the expires and expired tags, but cant get it to work.

As a clarification, the list shows the event article as a list with their excerpt. Form 2 is just taking care of a link to the full article if that exists. Article publishing date is used for the starting date, and the expires date is set to the end of that event.

Any idea how to archive that?

Last edited by [Axel] (2013-07-09 13:17:48)


Greetz [Axel]

Offline

#2 2013-07-09 13:29:16

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

Re: I have an event page, and need the current event at top of the list

Hi Axel, Here’s an untested solution. I’m not sure if it will work.

<txp variable name="expired_articles" value='<txp:article_custom section="events" limit="999" break="," wraptag="" time="past"><txp:article_id /></txp:article_custom>' />
<txp variable name="future_articles" value='<txp:article_custom section="events" limit="999" break="," wraptag="" time="future"><txp:article_id /></txp:article_custom>' />

<txp:article_custom section="events" time="any" limit="999">
<txp:if_article_id id='<txp:variable name="expired_articles" />,<txp:variable name="future_articles" />'>
<txp:hide>do not show any past or future articles</txp:hide>
<txp:else />
your tags for the remaining articles in the events section
</txp:if_article_id>
</txp:article_custom>

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

Offline

#3 2013-07-09 13:42:30

[Axel]
Member
From: Switzerland/Denmark
Registered: 2007-07-26
Posts: 65
Website

Re: I have an event page, and need the current event at top of the list

Unfortunately that’s just outputting everything as I had before * (times) 3

(only if I use my code after </txp:else> or if I leave your code untouched I get 3 * “your tags for the remaining articles in the events section”

Last edited by [Axel] (2013-07-09 13:47:25)


Greetz [Axel]

Offline

#4 2013-07-09 16:23:43

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

Re: I have an event page, and need the current event at top of the list

Axel wrote:

my problem is, that I need to have at top a section with events that are running right now. … Article publishing date is used for the starting date, and the expires date is set to the end of that event.

Sorry, I don’t understand the question. Isn’t <txp:article_custom section="events" form="events" limit="99" /> outputting exactly the articles that are published, but not yet expired (or have no expiration date)? A more difficult task is to output the already expired articles, but you don’t seem to complain about it.

Offline

#5 2013-07-09 16:43:16

[Axel]
Member
From: Switzerland/Denmark
Registered: 2007-07-26
Posts: 65
Website

Re: I have an event page, and need the current event at top of the list

both work fine, but the events are going mostly over 2 or more days, that means if an event has started it is pushed down to the past list. That’s why I want to have at the top a section with the current event.

Hpofully that is explaining my problem


Greetz [Axel]

Offline

#6 2013-07-09 17:55:37

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

Re: I have an event page, and need the current event at top of the list

  • wrote:*

if an event has started it is pushed down to the past list.

As I don;t us the time functionality I’m slightly confused. Are you actually saying that if an event started yesterday and finishes in 2 days from now the article is ‘seen’ as “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

#7 2013-07-09 18:15:18

[Axel]
Member
From: Switzerland/Denmark
Registered: 2007-07-26
Posts: 65
Website

Re: I have an event page, and need the current event at top of the list

<txp:article_custom section="events" form="events" limit="99" time="past" />

the code above shows all the articles with a past published date, but it doesn’t care about the expired date. so if an event has started but is not expired yet its showed here. unfortunately the attribute Time only accepts “past, future, or any” values.

But I found out now how to solve my problem.

using the code above with expired="0" is only showing the current article, where the posted date is in the past, but the article hasn’t expired yet.

Problem solved :-D

Last edited by [Axel] (2013-07-09 18:15:40)


Greetz [Axel]

Offline

#8 2013-07-09 18:37:34

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

Re: I have an event page, and need the current event at top of the list

Ah ok, you must have set the Publish expired articles preference to yes, so expired="1" by default. Still, your “past” articles list should contain the “present” articles too, so there is some redundancy.

Offline

#9 2013-07-09 18:49:37

[Axel]
Member
From: Switzerland/Denmark
Registered: 2007-07-26
Posts: 65
Website

Re: I have an event page, and need the current event at top of the list

yes I have set Publish expired articles to yes I think you misunderstood my problem. I needed to have three “sections”
current= events that are happening right now
future= upcoming events
past= past events

my problem was to filter the current events, but now it works the way as supposed


Greetz [Axel]

Offline

#10 2013-07-09 18:57:05

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

Re: I have an event page, and need the current event at top of the list

That’s fine, but <txp:article_custom section="events" form="events" limit="99" time="past" /> (your “past” events), as I get it, should contain also “current” events, so your sections are somewhat overlapping. Or I misunderstand the txp code, that’s possible too.

Offline

#11 2013-07-09 19:08:12

[Axel]
Member
From: Switzerland/Denmark
Registered: 2007-07-26
Posts: 65
Website

Re: I have an event page, and need the current event at top of the list

you are right… haven’t scrolled down that far, its overlapping… bummer

so still a problem how to get rid of that overlap, or how else to solve the problem

Last edited by [Axel] (2013-07-09 19:08:44)


Greetz [Axel]

Offline

#12 2013-07-09 19:20:20

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

Re: I have an event page, and need the current event at top of the list

I guess that’s what Yiannis proposed (with some modifications) for your past section:

<txp variable name="current_articles" value='<txp:article_custom section="events" expired="0" limit="999" break=","><txp:article_id /></txp:article_custom>' />

<txp:article_custom section="events" limit="999">
<txp:if_article_id id='<txp:variable name="current_articles" />'>
<txp:else />
	<txp:excerpt />
	<!-- and other tags for the expired articles -->
</txp:if_article_id>
</txp:article_custom>

Edit: Though this looks better:

<txp:article_custom section="events" expired="1" limit="999">
<txp:if_expired>
	<txp:excerpt />
	<!-- and other tags for the expired articles -->
</txp:if_expired>
</txp:article_custom>

Last edited by etc (2013-07-09 20:09:44)

Offline

Board footer

Powered by FluxBB