Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
how do i display custom message if ther is no article in a category
i have categories , i want to display a message if there are no article on that page for instance “sorry there is no content availeble at the moment “ right now i get an empty page .
how can i do this thx….
Offline
Re: how do i display custom message if ther is no article in a category
Put this snippet into your page template anywhere below txp:article
:
<txp:php>
global $thispage;
if ($thispage['total']==0 ) echo ("No articles found.");
</txp:php>
I use this method to display a message when full text search returns no hits.
Offline
Re: how do i display custom message if ther is no article in a category
it doesn’t seem to work if your category is a page , it does display the message , but there are article in the catergory
i use the wow menu plug in to display the category as a menu check the link out http://samaanta.project-8.nl/index.php?s=chauwtaal
under the calender you see the sub-menu generated with wow plugin.
here is my code and setup
each catergory has it’s own html page and this is the code for the article
<code><txp:article_custom form=“activiteit” category=“chauwtaal” sortby=“Posted” sortdir=“desc” listform=“sectie_artikel” />
</code>
now i put the code for displaying the message under the code that’s above
<code>
<txp:php>
global $thispage;
if ($thispage[‘total’]==0 ) echo (“<p>Er zijn momenteel geen activiteiten in deze category.</p>”);
</txp:php>
</code>
any idea why???? or anybody other suguestions?
Offline
Re: how do i display custom message if ther is no article in a category
My main suggestion would be not to have categories without any articles attached to them. Why have visitors click for nothing. I understand that the categories you have created will eventually have content but why not create them as you need them?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: how do i display custom message if ther is no article in a category
well main goal is actually is to create the catergory dynamicly, meaning i only have to make an article to the catergorie and then it’s there, so i don’t have to make a category for the article .
but textpattern can’t do this as far as i know , so my sugguestion is to have the category there but display a message if it’s empty
if this is not possible then , i would have to scratch the whole idea ,
but if anybody have a suguestion , please let me know …. :)
Offline
Re: how do i display custom message if ther is no article in a category
and idea is to let them go on the error page , how do i do that
so if category is empty , redirect to error page or some other page
Offline
#7 2006-06-01 13:57:59
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: how do i display custom message if ther is no article in a category
I think you can use the chh_if_data plugin for this.
Offline