Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-11-05 20:19:01

scdoody
Member
Registered: 2006-10-18
Posts: 129

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

#2 2006-11-05 22:50:42

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Issue with categories that do not have any assigned articles yet

Plugin: chh_if_data :)

Offline

#3 2006-11-06 08:55:53

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Re: Issue with categories that do not have any assigned articles yet

are you sure, that your main content div does not appear at all (check source) or is it just collapsing?
in that case you can put a line into your css (assuming you use #content) like

#content {min-width: 400px;}

or whatever you desire/your layout requires.


A hole turned upside down is a dome, when there’s also gravity.

Offline

#4 2006-11-06 16:03:19

scdoody
Member
Registered: 2006-10-18
Posts: 129

Re: Issue with categories that do not have any assigned articles yet

i figured it out – thanks!

Offline

#5 2006-11-07 02:57:27

scdoody
Member
Registered: 2006-10-18
Posts: 129

Re: Issue with categories that do not have any assigned articles yet

I have another problem with this. The “no articles in this category yet . . .” displays at the bottom of each page – not just when the user hits a category without any articles. Am I placing my conditional statements in the right place??

I am using this code:

<txp:if_individual_article >

<p><txp:link_to_prev><txp:prev_title /></txp:link_to_prev> <txp:link_to_next><txp:next_title /></txp:link_to_next></p>
<txp:else />

<p style=“float:left;”><txp:newer><txp:text item=”<< Previous Page”/></txp:newer></p>
<h3 ><txp:category /></h3>
<p>There are not any articles in this category yet.</p> <p style=“float:right; padding:0px 0px 15px 0px;”><txp:older><txp:text item=“Next Page >>” /></txp:older> </p>
</txp:if_individual_article>

Offline

#6 2006-11-07 03:24:16

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Issue with categories that do not have any assigned articles yet

Could you provide more context, as to where your above code occurs in your template and what the actual HTML is (Browser>View source)? Is there a side div or another element before it?

Also, see Posting Tags and code.

Offline

#7 2006-11-07 03:41:56

scdoody
Member
Registered: 2006-10-18
Posts: 129

Re: Issue with categories that do not have any assigned articles yet

That code is on my main default page (Presentation > Default).

What I’m trying to do is have a message display on the “archive” page (the page that lists all articles in a specific category) – when a category does not have any articles assigned to it yet.

Originally it was suggested that I use the chh_if_data plugin, but then someone said I could do it just using the if_individual_article. However, I’m thinking that the if_individual_article option is not going to work.

Any suggestions?

Offline

#8 2006-11-07 08:53:58

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Issue with categories that do not have any assigned articles yet

chh_if_data would do it for you and once you do have articles for everything you can delete the code you used to display the message and disable the plugin.

Last edited by colak (2006-11-07 08:55:23)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#9 2006-11-07 15:54:53

scdoody
Member
Registered: 2006-10-18
Posts: 129

Re: Issue with categories that do not have any assigned articles yet

I addded the chh_if_data code – but I get an “unknown tag” error. I checked in my plugins section and it says that the plugin is installed correctly. Any ideas based on this code?

<txp:chh_if_data />
<txp:if_individual_article >

<p><txp:link_to_prev><txp:prev_title /></txp:link_to_prev> <txp:link_to_next><txp:next_title /></txp:link_to_next></p>
<txp:else />
<p style=“float:left;”><txp:newer><txp:text item=”<< Previous Page”/></txp:newer></p>
</txp:if_individual_article>
<txp:else />
<h3 ><txp:category /></h3>
<p>There are not any articles in this category yet.</p> <p style=“float:right; padding:0px 0px 15px 0px;”><txp:older><txp:text item=“Next Page >>” /></txp:older> </p>
</txp:chh_if_data>

Offline

#10 2006-11-07 18:33:00

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Issue with categories that do not have any assigned articles yet

chh if data is a conditional, container tag. ie it is not self closing. Check the help of the plugin which reads:

<txp:chh_if_data>
    <h3>Here's an article list</h3>
    <txp:article_custom category="Nogo" />
<txp:else />
    <p>article_custom had nothing to say.</p>
</txp:chh_if_data>

<txp:chh_if_data>
    Static text will NEVER be shown.
    Drop a Txp tag in here!

</txp:chh_if_data>

Last edited by colak (2006-11-07 18:33:40)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB