Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2025-09-03 15:30:08

skewray
Member
From: Sunny Southern California
Registered: 2013-04-25
Posts: 232
Website Mastodon

Article list inside article

I am trying to make an index that goes at the top of a cluster of articles on the same subject. My definitely-doesn’t-work code so far is:

<txp:variable name="id" value="<txp:article_id />" />
<txp:article_custom id="61,63,64,65,66,62,67,68,15" sort="Posted asc" wraptag="ol" break="li">
    <txp:if_variable name="id" value="<txp:article_id />">
        Do something super special here
    </txp:if_variable>
    <txp:permlink>
        <txp:title />
    </txp:permlink>
</txp:article_custom

I (fail to) use a variable to save the article id, so I can (fail to) compare it to the article_custom id. How do I do this? I don’t see a way to get the article_custom id. Or just to somehow check if the two match.

Second, I want the sort to be in the order specified in id. Is there a way to do that, or do I need to create meta data for each article? (I think using meta data might be better anyway, but inquiring minds…)

Offline

#2 2025-09-03 15:48:33

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

Re: Article list inside article

Try single quotes round the value attribute of your if_variable tags and see if that improves things.


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

#3 2025-09-03 15:59:52

skewray
Member
From: Sunny Southern California
Registered: 2013-04-25
Posts: 232
Website Mastodon

Re: Article list inside article

That does make things better! For posterity, my form:

<txp:variable name="id" value='<txp:article_id />' />
<txp:article_custom series='<txp:yield name="series" />' sort="custom_3+0 asc" wraptag="ol" break="li">
    <txp:if_variable name="id" value='<txp:article_id />'>
        <i><txp:title /></i>
    <txp:else />
        <txp:permlink>
            <txp:title />
        </txp:permlink>
    </txp:if_variable>
</txp:article_custom>

The custom field “series” calls out the series of articles, and the third custom field gives the sort order.

Last edited by skewray (2025-09-03 16:35:32)

Offline

Board footer

Powered by FluxBB