Testing if a list is empty in textpattern

Let’s say you have a section on a webpage like the “current courses” section in the right menu bar my teaching webspace.

This draws its list from articles in the section “teaching” that have “current_interest” as a category.

The problem comes between semesters while I am preparing my syllabi. If no course has a category “current_interest” you end up with a header and no content.

What you need is something that checks whether there is content to display and then presents different material based on the outcome of that check. You might delete the section entirely, or, as I have done, display a placeholder message. Read the rest of this entry »


Get every new post delivered to your Inbox

Join other followers: