Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#49 2008-07-01 19:23:51

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

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

#52 2008-07-01 19:50:49

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

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

#53 2008-07-01 20:01:00

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

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

#55 2008-07-01 21:06:27

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

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,303

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

#58 2008-07-02 04:57:03

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

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,303

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

Board footer

Powered by FluxBB