Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-04-19 18:32:43

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

What if there isn't an article?

I want to list articles from a different section on a page of a specific category. I can do this, but what I can’t figure out is how to have a ‘no articles available’ message if there are none.

Any ideas?

Thanks.

Loz

Offline

#2 2008-04-19 18:37:10

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: What if there isn't an article?

Offline

#3 2008-04-19 18:51:52

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: What if there isn't an article?

Yes, the plugin Jukka pointed out will do what you want.

To elaborate on this, here’s a sample:

<txp:chh_if_data>
<txp:article form="property_listing" sort="Category1 desc, Category2 asc" limit="5" />
<txp:else />
<p>Sorry, there are currently no properties listed in the selected price range.</p>
</txp:chh_if_data>

I use this code on a property site to display a message, if there are currently no properties listed in the category chosen by the visitor.

Offline

#4 2008-04-19 19:13:26

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: What if there isn't an article?

On second thought, you might also find cbs_category_list helpful.
It will only list categories that contain any articles, not empty ones.

Offline

#5 2008-04-19 22:53:10

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: What if there isn't an article?

Perfect!

Thanks.

Loz

Offline

Board footer

Powered by FluxBB