Go to content Go to navigation Go to search

Interesting variations · Oct 29, 03:29 pm by Rick Silletti


Some interesting variations on the:

 <txp:ras_if_expired>

I revised the plugin to included an alter ego tag called:

 <txp:ras_if_current>

the two in tandem should be good for bracketing aricles by posting date as follows: “week” article form.

  <txp:ras_if_current offset="14">
   <txp:ras_if_expired offset="7">
   <p><txp:permlink> <txp:title /> </txp:permlink></p>
 </txp:ras_if_expired>
 </txp:ras_if_current>

Then

<txp:article_custom form="week" />

in your page template.

In this case if_expired checks for articles older than 7 days to return true (or the article link), it was originally designed to test for and return true when an article was expired. if_current returns true (or the article link) if an article is not older than 14 days, thus bracketing article links older than 7 days but not older than 14.

Both tags will accept an else clause and using that to avoid confusion with the names, well that`s up to you; I know they are giving me a bit of a headache.


Section: article


  1. Thanks for this helpful plugin. I’ve just installed it to set up a Press Release page, which I wanted to limit to articles less than 30 days old. This works brilliantly!


    Mike Lucas    Dec 1, 11:03 pm    #
  2. Thanks, it was originally written for someone who had a similar need.

    Would changing the name of the function make it a little easier to use?


    Rick Silletti    Dec 2, 12:20 am    #
  3. Thanks – this is fantastic. I was the original poster, but for some reason didn’t see your response until today. Wonderful stuff.

    Is there also some way to make TXP group archives by week, or would I be best off doing this with categories?

    Thanks again!


    Brendan    Dec 26, 07:56 pm    #
  4. if_different can select out months and days, but maybe not weeks. Trying to shuffle up a complete set of conditional tags like the ones in this article would be longwinded, maybe a combination of the two?

    The real difficulty arises with the need for dynamic inputs to the conditionals – gets a little hairy!


    Rick Silletti    Dec 26, 10:18 pm    #
Name
E-mail
http://
Message
  Textile Help