You are not logged in.
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.
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
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!
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!
This was changed in 4.0.8: names of newly created sections and categories are now converted to lowercase.
this was exactly what I was looking for – very clever use of the new Textpattern features!
You are smart :-)
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)
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?
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)
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.. for an extended block with blank lines).