Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-04-17 19:03:08

Torrent
New Member
Registered: 2008-04-17
Posts: 1

Detecting an Empty List

I am new to Textpattern but am an experienced programmer. I am trying to figure out how to display something special if a list is empty.

I have a page with a list of Articles on it. These are actually Events so will expire, but I want to be able to present a simple “Nothing right now, more coming soon” type thing. I have looked through all the Docs I can find and have not see an Is_List_Empty tag or plugin or whatnot.
Am I going about this the wrong way or just missing something?

Offline

#2 2008-04-17 19:34:12

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: Detecting an Empty List

<txp:chh_if_data>
	<txp:article />
<txp:else />
	Sorry - This is message - we don't have articles within current section\category
</txp:chh_if_data>

Use plugin chh_if_data


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#3 2008-04-17 20:22:11

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

Re: Detecting an Empty List

Or if you don’t need the plugin’s big features, then little line of php is enough:

<txp:php> if(article(array()) == '') echo 'This is message - we don\'t have articles within current section/category'; </txp:php>

Just option, as you, Torrent, said “programmer” that means you write programming languages :)

Last edited by Gocom (2008-04-17 20:22:54)

Offline

Board footer

Powered by FluxBB