Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Link list with parent/subcategories
I have a parent category “Resources” which has some subcategories like “Donation” and “Recycling”.
I am trying to output a list of the Resources links with this:
<txp:linklist category="Resources" sort="category" form="Links" limit="999" />
But it returns nothing, because the links are in the subcategories. But logically, it should output the links, because if they are in a subcategory of Resources, then they are also in the category Resources, right?
Do you agree this should be the behavior? Would it be difficult to hack it to make it happen?
I’d like my client to be able to add subcategories and links within them, and have them show up automatically in the list.
Thanks for any ideas.
Offline
Re: Link list with parent/subcategories
I think in the past I always used mem_glinklist to achieve this, though in the meantime there’s probably a way of doing it without a plugin (perhaps using if_different?).
TXP Builders – finely-crafted code, design and txp
Offline
#3 2009-01-28 23:05:49
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Link list with parent/subcategories
I think this will work:
<txp:category_list type="link" parent="resources" exclude="resources" sort="title" wraptag="ul" break="li">
<txp:category title="1" />
<txp:linklist category='<txp:category />' wraptag="ul" break="li">
<txp:linkdesctitle /><!-- or whatever you have in your link form -->
</txp:linklist>
</txp:category_list>
Note: Don’t use capitals in category (or section) names!
Offline
Re: Link list with parent/subcategories
Oh, brilliant. Yes I think that’s going to work.
Yeah – what is up with the lowercase/uppercase thing? I could have sworn that Category names were automatically changed to lowercase (while capitalization was retained in the Titles) but that doesn’t seem o be the case in 4.0.7.
Does this cause problems in urls? Are there other issues? If it causes problems, shouldn’t they automatically be string-to-lowered?
Els thanks for your category_list!
Offline
#5 2009-01-28 23:22:51
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Link list with parent/subcategories
This was changed in 4.0.8: names of newly created sections and categories are now converted to lowercase.
Offline
#6 2009-02-26 23:48:05
- masa
- Member
- From: Asturias, Spain
- Registered: 2005-11-25
- Posts: 1,091
Re: Link list with parent/subcategories
Thanks Els,
this was exactly what I was looking for – very clever use of the new Textpattern features!
You are smart :-)
Offline
Re: Link list with parent/subcategories
Hi, Els.
I want to do exactly the same that nabrown78 wanted. I’m using the code you pasted below, but it doesn’t work for me. I obtain a bullet list of subcategories of links, but no link at all.
Perhaps the problem is that your proposal is very old, and some things have changed in the way TXP works. I’ m using TXP 4.4.1. Do you have some idea to fix it? Thanks in advance.
Last edited by pompilos (2012-06-20 23:21:34)
Offline
#8 2012-06-21 20:02:45
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Link list with parent/subcategories
Hi José, I don’t see why that code would not work in 4.4.1. What it does is produce a list of links that are in subcategories of (in the example) category ‘resources’. I assume you checked that such links exist?
Can you post a tag trace please?
Offline
Re: Link list with parent/subcategories
Hi, Els.
Here is what I obtain with a tag trace using the code you posted (and yes, the links of these subcategories exist):
<p><p class="category_list">
Subcategory 1
<txp:linklist category='subcategory-1‘ wraptag=“ul” break=“li” form=“Links” /><br />
<br />
Subcategory 2
<txp:linklist category='subcategory-2‘ wraptag=“ul” break=“li” form=“Links” /><br />
</p></p>
Is perhaps a problem with quotation marks? And what is creating these typographic quotation marks?
Last edited by pompilos (2012-06-24 15:57:02)
Offline
#10 2012-06-24 14:28:25
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Link list with parent/subcategories
Ah, do you have this code inside an article? It looks like Textile is in the way. If so, disable Textile for that article, or wrap it in <notextile>...</notextile>
, or start the lines of code with a space, or use notextile.
(or notextile..
for an extended block with blank lines).
Offline
Re: Link list with parent/subcategories
Hi, Els. You’re right. The use of <notextile>...</notextile>
solved the problem. Thank you very much from Spain.
Last edited by pompilos (2012-06-24 16:21:27)
Offline
Pages: 1