Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
1.0
About It:
Get it:
Rate it:
  • Helpful?
  • 1 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

msv_if_custom_article_date

Usage
Using this conditional tag you can compare a date specified in an article custom field with a date specified in the tag or with ‘today’.
This way you can eg. control the visibility of an article or its part according to dates.

Classification
The msv_if_custom_article_date tag is a Conditional Tag, and therefore a Container Tag, The tag will execute the contained statement if a date set in a specified custom field is greater/less/greaterequal/lessequal/equal/notequal compared to a date set in the tag.

Syntax

The tag has the following syntactic structure:

<txp:msv_if_custom_article_date> 
...your content here... 
</txp:msv_if_custom_article_date>

Attributes

  • is=“greater/less/greaterequal/lessequal/equal/notequal” (default ‘equal’)
  • date=“date in format dd.mm.yyyy” (default is today)
  • customfield=“number of a custom field with a date associated to article” (default ‘1’)
  • dateseparator=“a character that separates day, month and year in a date string” (default ‘.’)

Other notes

  • In case the specified custom field is empty, the contained statement will be executed.
  • Date in a custom field should be in format dd.mm.yyyy

Examples

*Classical ‘publish until date’ condition.*

The article will be published until date specified in the custom field number 4 (date in format ‘dd.mm.yyyy’).

<txp:msv_if_custom_article_date is="greaterequal" customfield="4">
...ArticleContent...
</txp:msv_if_custom_article_date>

*More complicated example*

The Content will be published if date specified in the custom field number 1 (date in format ‘dd-mm-yyyy’) is less than 11th November 2006 (date in format ‘dd-mm-yyyy’).

<txp:msv_if_custom_article_date is="less" customfield="1" 
dateseparator="-" date="11-11-2006">
...Content...
</txp:msv_if_custom_article_date>

Article Request Count:
Initially released:
25/9/2006
Posted here:
25 Sep 2006
Article modified:
20 Mar 2007

If there is a comment form at the Information URL, you may want to leave your comments/questions there or at the Forum thread for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (5)

Lee:
A very useful plugin.
Thanks.
Lee
rtxpn:
This plug-in is exactly what I’ve been looking for. I’d like to use it to have articles automagically “die” after a specified date, not a posting/modification date like similar plug-ins I’ve found.

I’ve tried many ways of getting this to work but I have not been successful.

I admit to getting confused reading things like ”...will be published if date specified in the custom field number 1 (date in format ‘dd-mm-yyyy’) is less than 11th November 2006.” Less than? I’m not used to thinking about dates in greater/less than terms but I’ve tried each of the options without success (i.e., greater/less/greaterequal/lessequal/equal/notequal).

I’ve also tried inputting a date with / and – and changing the dateseparator appropriately, again, without success.

Could anyone that’s gotten this to work for them give an example?

Also, the linked file above goes to the author’s other plugin, msv_show_article_field, not msv_if_custom_article_date.

Wrong link? Seems like the URL goes to another plugin of yours(?)

Thanks for your plugin.
I have looked at a few plugins, but they don’t meet my requirement until I come across yours.
It’s very useful and I like it so much.

Keep up with your good work.

Cheers,

Makara Kao

An awesome plugin, thanks for creating it!

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

Would you care to write a comment or visit the forum discussion?

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern