Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2018-03-17 02:54:57
- anndylala
- New Member
- Registered: 2018-03-17
- Posts: 1
Issue with categories that do not have any assigned articles yet
I have a two column design. On the left is the main content, and on the right is the navigation such as category links etc.
When I click on a category that does not have any assigned articles, I am sent to a page that throws my right column all the way to the left and it appears that the main content div is not even on the page.
Does anyone know how I can display a message that says something like “no articles in this cateogry yet” when a category without any articles is clicked on?
Thanks!!
Offline
Re: Issue with categories that do not have any assigned articles yet
This is a variation of something I came up with previously (that I had totally forgotten about until I searched the forums):
<section>
<header>
<h2>Category Archives for <txp:category title="1" /></h3>
</header>
<txp:variable name="contains-articles" value="false" />
<txp:article section="article" limit="1">
<txp:variable name="contains-articles" value="true" />
</txp:article>
<txp:if_variable name="contains-articles" value="false">
<p>There are no articles in this category. Check back later.</p>
<txp:else />
<txp:article break="li" form="date" limit="999" section="article" wraptag="ul" />
</txp:if_variable>
</section>
You can see it in action here.
Edit: An earlier version of this used adi_calc until I realized it was totally unnecessary because we were testing a true/false: whether or not there were articles.
Last edited by michaelkpate (2018-03-17 05:09:55)
Offline
Re: Issue with categories that do not have any assigned articles yet
michaelkpate wrote #310055:
This is a variation of something I came up with previously (that I had totally forgotten about until I searched the forums):
<section>...
With TXP 4.7 beta you can simplify that:
<txp:evaluate>
<txp:article break="li" form="date" limit="999" section="article" wraptag="ul" />
<txp:else />
<p>There are no articles in this category. Check back later.</p>
</txp:evaluate>
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: Issue with categories that do not have any assigned articles yet
phiw13 wrote #310064:
With TXP 4.7 beta you can simplify that:
or even this:
<txp:article break="li" limit="999" section="article" wraptag="ul" />
<txp:output_form form="date" />
<txp:else />
<p>There are no articles in this category. Check back later.</p>
</txp:article>
Offline