Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-01-30 10:27:21

matteo
Member
Registered: 2013-12-19
Posts: 26

Category list

I would like to show a category list where by clicking on the category name I get redirected to the list of articles with that category.
Thank you very much!

Matteo

Offline

#2 2014-01-30 11:36:09

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Category list

Check out <txp:category_list /> in the user documentation, it has info and examples of how to do that.

Offline

#3 2014-01-30 11:45:18

matteo
Member
Registered: 2013-12-19
Posts: 26

Re: Category list

With the code of documentation I can see the list but does not link refer to any article with that category.
Where is the problem?

Offline

#4 2014-01-30 12:21:16

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: Category list

Do you use txp:category_list with a form or as a container?

Have you included <txp:category title="1" link="1" /> as the example 3 shows (txp:category)?

Last edited by GugUser (2014-01-30 12:21:40)

Offline

#5 2014-01-30 13:14:07

matteo
Member
Registered: 2013-12-19
Posts: 26

Re: Category list

I Have include <txp:category title=“1” link=“1” />.
I use txp:category_list with a form.

Offline

#6 2014-01-30 13:50:39

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: Category list

Please show your code.

Offline

#7 2014-01-30 13:57:40

matteo
Member
Registered: 2013-12-19
Posts: 26

Re: Category list

<txp:if_article_section name="ricette">

  <txp:category_list wraptag="ul" break="">
    <li<txp:if_category name='<txp:category />'> class="active"</txp:if_category>>
      <txp:category title="1" link="1" />
    </li>
  </txp:category_list>

<txp:else />

  <txp:article_custom section='<txp:section />' status="live" limit="999">
    <li><txp:permlink><txp:title /></txp:permlink></li>
  </txp:article_custom>

</txp:if_article_section>

{Edited to add Textile’s bc.. for straight quote display. – Uli}

Last edited by uli (2014-01-30 17:00:41)

Offline

#8 2014-01-30 14:00:48

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,547
Website GitHub Twitter

Re: Category list

Hi

If i understund the category list is shown but the link is not sending you the right place, have you use some section to your aticles? if it s that you need to add it to the category tag like this:

<txp:category title=“1” link=“1”  section="yoursection" />

Offline

#9 2014-01-30 15:04:34

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: Category list

  1. Caution with the quotation marks in your code.
  2. The category-list is shown in an individual article context from the section “ricette”.
  3. Are there in the section “ricette” articles with categories?
  4. How ist the code in the page dedicated to the section “ricette”?

Last edited by GugUser (2014-01-30 15:05:10)

Offline

#10 2014-01-31 13:53:06

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: Category list

It would be nice if you would give feedback if your issues have been resolved.

Offline

#11 2014-01-31 14:54:20

matteo
Member
Registered: 2013-12-19
Posts: 26

Re: Category list

I have not solved either by entering the section:

<ul id=“secondary-menu”>

<txp:if_article_section name=“ricette”>

<txp:category_list wraptag=“ul” break=”“>
<li<txp:if_category name=’<txp:category />’> class=“active”</txp:if_category>>
<txp:category title=“1” link=“1” section=‘ricette’ />
</li>

</txp:category_list>

<txp:else />

<txp:article_custom section=’<txp:section />’ status=“live” limit=“999”>
<li><txp:permlink><txp:title /></txp:permlink></li>
</txp:article_custom>

</txp:if_article_section>

</ul>

Offline

#12 2014-01-31 15:46:45

etc
Developer
Registered: 2010-11-11
Posts: 5,393
Website GitHub

Re: Category list

Hi,

I don’t know if it’s related, but section="ricette" will not restrict categories to those having articles in the section “ricette”, it will simply add “ricette” section to the category url. So, if you have a category “teatro”, the link will be output (in messy mode) as

<a href="...?s=ricette&c=teatro">Teatro</a>

Clicking on it will show all articles in section “ricette” with category “teatro”, which can be an empty list.

Offline

Board footer

Powered by FluxBB