Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: ras_if_expired (conditional, expiration, date)
As I presumed: </txp:else> is not the desired valid form of “else”, change it to <txp:else />. If that isn’t sufficient yet – though it should be – try downloading the plugins for 4.0.6 if_dates is contained herein.
hi, i kept trying to put it in textile posting code, but it just wouldn’t play with me. ok so i tried updating the plugin, i also fixed the else / – but still no avail. it now outputs “There is nothing good today” two times after which signifies there are two other articles that we’re not seeing because they are posted on different days.
<txp:ras_if_dates_today>
<h3><txp:title /></h3>
<txp:body />
<h2>Start Time: <txp:custom_field name="time" /><br/>
Venue: <txp:custom_field name="venue" /><br/>
Price: <txp:custom_field name="price" />
</h2>
<txp:else />
Nothing's good today
</txp:ras_if_dates_today>
Last edited by mrtunes (2008-06-30 21:12:37)
Offline
#47 2008-06-30 22:05:41
- uli
- Moderator

- From: Cologne
- Registered: 2006-08-15
- Posts: 4,319
Re: ras_if_expired (conditional, expiration, date)
There are a lot of options to keep in mind in order for this to work. What you should check (ordered by likeliness):
- Are there articles with all of the following three criteria
- the right choice for “override form” (the one with the ras tags in it)
- a date set to today (checkbox for
Set timestamp to now) - with status “live”
- If you still get no articles displayed: Do you filter away articles by any of the following
- restrictions in your article tags (category, section, custom field, etc.)
- filtering by conditionals wrapped around the article tags
Are there two article tags calling articles, on eitherFinally understand your sentence about the double messagesyour page, orin any of your forms
If all this doesn’t give you the one hint, please post the page (or form) where the article tag(s) appear.
Edit: Because you’ve written the else tag the wrong way twice, maybe this is a “habit”. Look for further occurrences of else, applying smd_where_used helps a lot for locating occurrences of any kind of tag/form/page name/plugin/term used.
Last edited by uli (2008-06-30 22:44:42)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: ras_if_expired (conditional, expiration, date)
thanks for the checklist. i’m sure that most of this criteria has been met, so i’ll just reiterate my problem and what i think the solution should be. i do have this plugin working correctly, it’s pulling the right articles up. it’s this else thing that isn’t working. so here is my default page code:
<div id="content">
<txp:article_custom form="article_listing" limit="5" pgonly="0" />
</div>
so instead of doing this conditional in my form, why not add something to my default page that says, “if none of these custom articles from article_listing are pulled up, display a message that says, yada”. from what i understand there is no if_article_custom tag but is there some sort of plugin to fix this?
Offline
#49 2008-07-01 19:23:51
- uli
- Moderator

- From: Cologne
- Registered: 2006-08-15
- Posts: 4,319
Re: ras_if_expired (conditional, expiration, date)
If you don’t use the above article tag for pulling out other articles than just these from today, there’s an easy way: chh_if_data. You can wrap your article into its tags. txp:else applies to it too.
If not, I’d need the whole page’s code.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#50 2008-07-01 19:25:41
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: ras_if_expired (conditional, expiration, date)
article_custom won’t use the pgonly attribute, it’s an article tag att to prohibit the generation of article content whilst allowing the article tag to generate pagination statistics, the way you are using it here is a NULL value.
Still not entirely clear on what your problem is, or what you are trying to accomplish?
Offline
#51 2008-07-01 19:47:05
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: ras_if_expired (conditional, expiration, date)
If you are trying to show an article’s content if it was published today, and “nothing good today” if nothing was posted today, limit your articles returned with limit=“1”, with the tag arrangement you used below.
If you need more content on the same page use the offset attribute and a second article tag.
Offline
Re: ras_if_expired (conditional, expiration, date)
uli wrote:
If you don’t use the above article tag for pulling out other articles than just these from today, there’s an easy way: chh_if_data. You can wrap your article into its tags. txp:else applies to it too.
If not, I’d need the whole page’s code.
ok gave chh_if_data a whirl, and it is also not helping :(
i’ve tried these two options.
on the default page:
<div id="content">
<txp:chh_if_data>
<txp:article_custom form="article_listing" limit="5" />
<txp:else />
<h1>Can't Help You</h1>
</txp:chh_if_data>
that didn’t output anything when no articles were matched, so i tried reverting default page to the basic custom article code and tried chh in the form:
<txp:chh_if_data>
<txp:ras_if_dates_today>
<h3><txp:title /></h3>
<txp:body />
<h2>Start Time: <txp:custom_field name="time" /><br/>
Venue: <txp:custom_field name="venue" /><br/>
Price: <txp:custom_field name="price" />
</h2>
</txp:ras_if_dates_today>
<txp:else />
<h1>Can't Help You</h1>
</txp:chh_if_data>
and this took me back to square one, spitting out “ Can’t Help You” three times to signify there are three articles in my database.
Rick: i’m making a simple application for mobile phones where people can log on to the site and find out what concerts are going on in the city on a particular day. if there is nothing going on it has to tell them sorry check back on the weekend. it’s a public service from one music fan to other music fans so i appreciate the help thus far.
just saw your most recent post and will try limiting it to 1
Offline
Re: ras_if_expired (conditional, expiration, date)
rsilletti wrote:
If you are trying to show an article’s content if it was published today, and “nothing good today” if nothing was posted today, limit your articles returned with limit=“1”, with the tag arrangement you used below. If you need more content on the same page use the offset attribute and a second article tag.
ok, so you got what i’m trying to do, but how would i use the offsets succuessfully? keep in mind i’ve reverted back to the normal form that has no chh_if_data.
limit=“1” made the conditional work on the ras_if plugin on the form, so i guess the offset could be the answer.<div id="content">
<txp:article_custom form="article_listing" limit="1" />
<txp:article_custom form="article_listing" limit="1" offset="1" />
<txp:article_custom form="article_listing" limit="1" offset="2" />
</div>
????
Offline
#54 2008-07-01 20:57:49
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: ras_if_expired (conditional, expiration, date)
Articles today could be used in a separate form using the if_dates conditionals called articles_today, if you are likely to post more than one article, up your limit to cover what you need. To avoid the follow on nothing today content you could arrange if_dates_before or after tags as a wrapper to return the Nothing Today response if there are no postings, and then simplly dispense with the else clause with if_dates_today.(it would take the current svn from development 4.0 to be able to nest them).
The offset attribute starts the returned list at the second article, then proceeds to the limit, or the third if offset is 2… and so on, to provide more content to the rest of the page.
If all you need is to post an article for a current event today and you don’t need more than one, setting your limit to 1 and using your original tag arrangement should give you what you want.
These tags can be complicated to use until you get used to them.
I was thinking more like this for extra content.
<div id=“content”>
<txp:article_custom form=“articles_today” limit=“1” />
<txp:article_custom form=“article_listing” limit=“2” offset=“1” />
</div>
Last edited by rsilletti (2008-07-01 20:58:59)
Offline
Re: ras_if_expired (conditional, expiration, date)
i want to be able to post say up to three events/articles on any given day, and then many days have no articles. what i could do is be more creative with the custom fields though. instead of having one event per article, i could use all the custom fields to do all my events in one article and limit to “1”.
edit: but this would be very limiting as it would need a lot of conditionals for each custom field so that they don’t show up if there’s no event in them. also requires you to hack the 10 custom fields limit
Last edited by mrtunes (2008-07-01 21:13:20)
Offline
#56 2008-07-01 21:16:37
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: ras_if_expired (conditional, expiration, date)
Might look at this zem_event as well, I don’t use it myself so don’t try to help with it overly much, but it is there.
..or take this for a spin (it should allow you to put your limit wherever you like), I haven’t tested it but it should give the idea. It should at the first article returned, if its in yesterday it should return “Nothing good today” once. If the first article (or more) is in today it should return the article content wrapped in dates_today and skip the else clause.
<txp:ras_if_dates_today>
<h3><txp:title /></h3>
<txp:body />
<h2>Start Time: <txp:custom_field name="time" /><br/>
Venue: <txp:custom_field name="venue" /><br/>
Price: <txp:custom_field name="price" />
</h2>
<txp:else />
<txp:ras_if_date_before>
<txp:if_first_article>
<p>Nothing good today</p>
</txp:if_first_article>
<txp:ras_if_dates_before>
</txp:ras_if_dates_today>
Last edited by rsilletti (2008-07-01 21:34:34)
Offline
#57 2008-07-01 21:43:07
- uli
- Moderator

- From: Cologne
- Registered: 2006-08-15
- Posts: 4,319
Re: ras_if_expired (conditional, expiration, date)
Elliot, I had many conditionals not working at first try, but chh_if_data was never among, too easy to apply. That’s why I think even more there will be a tag fault in your code, anywhere above of what you posted.
[Edit: waited too long with my answer. Yes, try Ricks proposal.]
Last edited by uli (2008-07-01 21:44:57)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: ras_if_expired (conditional, expiration, date)
rsilletti wrote:
or take this for a spin (it should allow you to put your limit wherever you like), I haven’t tested it but it should give the idea. It should at the first article returned, if its in yesterday it should return “Nothing good today” once. If the first article (or more) is in today it should return the article content wrapped in dates_today and skip the else clause.
success! this worked. thanks very much for being patient with me guys. to be honest i don’t exactly know how that works but in time i hope to figure it out hehe.
Offline
#59 2008-07-02 05:07:13
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: ras_if_expired (conditional, expiration, date)
I know that feeling, you’re welcome.
Offline
#60 2008-07-02 09:31:38
- uli
- Moderator

- From: Cologne
- Registered: 2006-08-15
- Posts: 4,319
Re: ras_if_expired (conditional, expiration, date)
thanks very much for being patient with me guys.
We had a walk over compared to you, who had to deal with your frustrations and two obstinate guys ;)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline