Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2024-01-11 18:38:30

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

Re: Making nested lists

Destry wrote #336368:

The single block method does seem to add a bunch of br tags, messing up the spacing, and I’m not sure where those are coming from.

Textile, perhaps?

I’ll stick with the form approach. It makes more sense to Tuco.

It’s fine, I’m just thinking out loud.

Offline

#38 2024-01-12 16:28:12

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Making nested lists

Textile, perhaps?

Ah, perhaps. I am using escape="textile" on the dd output because I want formatting in there.

Please keep thinking aloud. We all benefit from it. I am marveled by (and grateful for) your mastery of character magic.

Offline

#39 2024-01-12 18:00:28

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Making nested lists

The last piece of the puzzle for me is to have control over the order of the individual links in each list. The Sort value field in the links form doesn’t seem to be having an effect. I’ve tried numbers and letters (a, b, c, …) but the link items just keep sitting in the same position. What am I missing?

Offline

#40 2024-01-12 19:49:40

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

Re: Making nested lists

If you are using this code, try adding linksort (or linkname) to sort attribute:

<txp:linklist ... sort="category, linksort" ... >

Offline

#41 2024-01-13 06:38:21

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Making nested lists

linksort worked. Thank you.

Offline

#42 2024-02-14 13:44:43

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Making nested lists

I’m adding this to the linklist block to try and output the year for the link time stamp…

<txp:evaluate query='<txp:link_date format="%Y" />'><txp:link_date wraptag="Published <+>" /></txp:evaluate>

But it outputs the day, month, and year format as set in preferences (e.g. 12 May 1992).

Incidentally, the docs say ‘any valid strftime string values’, but that seems to be deprecated now.

So I tried a value of YYYY, which seems rather common (e.g W3CDTF reference), and that still outputs the full date.

Is there a way to force just the year to output for links only?

Offline

#43 2024-02-14 14:32:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Making nested lists

It’s because your link_date tag – the one that actually outputs the published string – doesn’t have a format attribute. You don’t need that attribute in the evaluate query because it’s only testing for the existence of the tag’s content.

In fact you can probably get away with test="link_date" instead of the query:

<txp:evaluate test="link_date">
   Published <link::date format="%Y" />
</txp:evaluate>

Last edited by Bloke (2024-02-14 14:36:56)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#44 2024-02-14 14:39:57

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

Re: Making nested lists

Do you really need <txp:evaluate /> here?

<txp:link_date format="%Y" wraptag="Published <+>" />

Offline

#45 2024-02-14 14:41:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Making nested lists

Oleg’s is even better. Forgot we could use the UFO thing directly without it. Nice one.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#46 2024-02-14 14:58:28

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Making nested lists

I just copied the code from somewhere and adjusted the format. I have no clue what evaluate was supposed to do. I didn’t even see there were two instances of link_date there.

Your consolidation works as expected. Thanks.

Offline

Board footer

Powered by FluxBB