Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
How to omit data from articles posted at midnight?
hello forum,
i asume i have a pretty esoteric problem. for my photofestival website i have about 60 exhibitions each of which is an article. some exhibitions have a vernissage, some not.
i use <txp:posted >
to output the date and time of the vernissage:
<h4>Vernissage</h4>
<p><txp:posted format="%d.%m.%Y, %H:%M" /> Uhr</p>
works fine, but obviously if there is no vernissage, than there is no time set and it outputs 00:00 Uhr.
does anybody have an idea how i could omit the whole snippet in case time is set to 00:00? i was thinking of a solution with <txp:variable >
but i’m lacking the programmer skills to tell the @<txp:if_variable > tag “if time is 00:00 do nothing, else output my snippet”.
so any idea or hint is much appreciated. thanks for your time.
christoph
Offline
Re: How to omit data from articles posted at midnight?
<txp:variable name="vernissage_time"><txp:posted format="%d.%m.%Y, %H:%M" /></txp:variable>
<txp:if_variable name="vernissage_time" value="00:00"><!-- make double-sure that's exactly correct! -->
<!-- do nothing -->
<txp:else />
<h4>Vernissage</h4>
<p><txp:posted .... etc.... ></p>
</txp:if_variable>
Last edited by maruchan (2012-06-20 22:13:58)
Offline
Re: How to omit data from articles posted at midnight?
hi maruchan,
thank you. for some weird reason this produces a tag error for <txp:else />
. can’t see why, as the part before the else-statement is parsed (“Keine Vernissage” in case it’s 00:00).
<txp:variable name="vernissage_time"><txp:posted format="%H:%M" /></txp:variable>
<txp:if_variable name="vernissage_time" value="00:00">
<p>Keine Vernissage</p>
<txp:else />
<h4>Vernissage</h4>
<p><txp:posted format="%d.%m.%Y, %H:%M" /> Uhr</p>
</txp:if_variable>
tag trace:
<txp:article>
<txp:title />
<txp:custom_field name="Kuenstler" />
<txp:custom_field name="Galerie" />
<txp:custom_field name="Strasse_Nr" />
<txp:custom_field name="PLZ" />
<txp:custom_field name="Stadt" />
<txp:custom_field name="Telefon" />
<txp:custom_field name="Internet" />
<txp:custom_field name="Internet" />
<txp:posted format="%d.%m." />
<txp:expires format="%d.%m." />
<txp:variable name="vernissage_time">
<txp:posted format="%H:%M" />
</txp:variable>
<txp:else />
Fehler im Tag: <txp:else /> -> Textpattern Warning: Unbekannter Tag on line 1202
<txp:posted format="%d.%m.%Y, %H:%M" />
</txp:article>
it says “unknown tag on line 1202 …
Last edited by colak (2012-06-21 04:45:52)
Offline
Re: How to omit data from articles posted at midnight?
HI
there must be a n underscore for txp_variable, it s missing.
Offline
Re: How to omit data from articles posted at midnight?
hi, thank you both very much. now it works. it’s the details, that matter – as always ;-)
Offline
Re: How to omit data from articles posted at midnight?
there is also an underscore missing from the post here
It should be:
<txp:if_variable name="vernissage_time" value="00:00">
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: How to omit data from articles posted at midnight?
Fixed my example for future TXPers. :-)
Offline