Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2023-07-22 20:21:33

agovella
Member
From: Houston, TX
Registered: 2005-05-01
Posts: 65
Website Twitter

Dynamically display content from second article on first article?

On the page for article A, I would like to display some content from article B. Articles A & B are in the same section, and article B is “sticky”.

This code seems like it should work, but it doesn’t.

<txp:article_custom section="<txp:section link="0" title="0" />" status="sticky">
    <li><txp:title /> <br>
    <txp:meta_description format="" /></li>
</txp:article_custom>

Or, is there a better way to do this?

Offline

#2 2023-07-22 22:33:00

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

Re: Dynamically display content from second article on first article?

I expect the reason it doesn’t work is your use of quotes. If you want to process the stuff inside the section attribute as a txp: tag and have it consider the output of that tag rather than the actual string content of what you typed, you’ll need to surround it with single quotes:

<txp:article_custom section='<txp:section link="0" title="0" />' status="sticky">
...

See parsed attribute values for more insight.


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 2023-07-22 23:47:54

agovella
Member
From: Houston, TX
Registered: 2005-05-01
Posts: 65
Website Twitter

Re: Dynamically display content from second article on first article?

Thank you so much. That worked.

I spent hours on that. I thought about the quotes and never tried it. Thank you!

Offline

Board footer

Powered by FluxBB