Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-11-25 09:38:55

sambooth74
Member
From: Leeds, England
Registered: 2020-11-24
Posts: 18
Website

List of links, grouped by category

Hi,

I’m new so apologies for the basic question.

I am trying to generate a Links page, to output every link, grouped by category.

“For each link category, display a Heading 4 with the category name, then an unordered list of hyperlinks in that category.”

This is what I want my output to look like:

Walking

Canoeing

Cycling

And here is the code I have tried:

<txp:category_list wraptag="ul" break="li" type="link">
    <txp:category title="1" wraptag="h4" />
    <txp:linklist wraptag="ul" break="li" category="<txp:category />" />
</txp:category_list>

The headings are displayed properly, but there are no links.

If I hard-code a category name then it works, so I think it’s category="<txp:category />" that is the problem.

I don’t know what I am doing wrong, so any help would be appreciated. Thanks in advance.

Offline

#2 2020-11-25 09:43:39

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

Re: List of links, grouped by category

Hi, welcome to the forum.

sambooth74 wrote #327043:

If I hard-code a category name then it works, so I think it’s category="<txp:category />" that is the problem.

You are right, one must use single quotes here : category='<txp:category />'.

Offline

#3 2020-11-25 09:44:42

sambooth74
Member
From: Leeds, England
Registered: 2020-11-24
Posts: 18
Website

Re: List of links, grouped by category

etc wrote #327045:

Hi, welcome to the forum.

You are right, one must use single quotes here : category='<txp:category />'.

I had not noticed the difference between double and single quotes here! Thank you for your help.

Offline

Board footer

Powered by FluxBB