Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-04-06 07:09:56

Qwest
Member
From: London, UK
Registered: 2007-01-24
Posts: 112

Conditional tags?

I hope you guys can help!

On one of my textpattern sites promotes clubnights. On the frontpage, I use the plugin glx_if_frontpage to show a <txp:custom_article> tag which shows the next event planned…

The way the event’s are set up is each article-posted field is changed to the date of the event, and then the txp pages would show any events which have posted dates in the future. Once the date has passed, they’re then archived. It’s a really nice & automatic way of moving events from upcoming to archived.

This has worked nicely for the past couple of years or so – however from time to time, there isn’t an event to actually promote as the details for the next event haven’t been released yet… so the frontpage still shows the div where the flyer & details would appear, but obviously no details.

I was hoping there would be a conditional tag which would check whether any events in the section “events” are in the future. If not, then don’t display the div.

The website is http://clubtrinity.co.uk (please excuse the mess – I’m tweaking!) and there isn’t a forthcoming event at the moment – so the yellow bar at the top (below the navigation) is where the next event would appear.. Is there a conditional tag which i could use to remove this?

Thanks!

Last edited by Qwest (2009-04-06 07:11:22)

Offline

#2 2009-04-06 07:41:58

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

Re: Conditional tags?

chh_if_data might do the job

something like

<txp:chh_if_data>
<div class="yourclass"><txp:artcle_custom /></div>
<txp:else />
<p>no news</p>
</txp:chh_if_data>

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 2009-04-06 08:32:23

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Conditional tags?

Or, with out any plugins (TXP 4.0.7 and above), for example:

<txp:variable name="is_event" value='<txp:article_custom />' />
<txp:if_variable name="is_event" value="">
	<p>No news</p>
<txp:else />
	<txp:article_custom />
</txp:if_variable>

Offline

#4 2009-04-06 14:52:26

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

Re: Conditional tags?

Or move the div into the article form.

Offline

#5 2009-04-06 23:00:28

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

Re: Conditional tags?

Or in 4.0.7+ use wraptag:

<txp:article_custom wraptag="div" class="div_class" ... />

Offline

Board footer

Powered by FluxBB