Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-03-07 17:07:04

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 252
Website

Article within an article

Hello,
is there any way to nest an article within an article, such as writing <txp:article_custom category="somecategory" /> in the textile article field?

Thanks

Offline

#2 2011-03-07 17:17:39

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,257
Website GitHub Mastodon Twitter

Re: Article within an article

Untested.

Your code is not returning an article but a list of articles… i think.

If you wish to use this extensively you could create a custom field named nested and in your page template you could have something like

<txp:if_custom_field name="nested">
<txp:article_custom id='<txp:custom_field name="nested" />'>
<txp:body />
</txp:article_custom>
</txp:if_custom_field>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2011-03-07 17:17:50

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Article within an article

Manaus wrote:

is there any way to nest an article within an article, such as writing <txp:article_custom category="somecategory" /> in the textile article field?

Yes, by doing exactly what you say: just put that code into your article body.


Code is topiary

Offline

#4 2011-03-10 17:40:45

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 252
Website

Re: Article within an article

Thanks everybody for the quick answers
@jsoo: I tried out your suggestion, but txp returns a circling reference error (the article loads himself)…

Offline

#5 2011-03-10 18:21:51

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,257
Website GitHub Mastodon Twitter

Re: Article within an article

you can also try

notextile. <txp:article_custom id="123">
<txp:body />
</txp:article_custom>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#6 2011-03-10 22:11:58

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Article within an article

Manaus wrote:

Thanks everybody for the quick answers
@jsoo: I tried out your suggestion, but txp returns a circling reference error (the article loads himself)…

Ah — right. You do need to avoid that case. It’s safe to put article_custom into an article body otherwise. So, using article_custom category="something", you would have to use a category not assigned to the current article to be on the safe side.


Code is topiary

Offline

#7 2011-03-10 23:15:23

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Article within an article

Manaus wrote:

I tried out your suggestion, but txp returns a circling reference error (the article loads himself)…

When I created a sitemap in an article, as described in this TXP Tip, I found out that when using an article_custom tag in an article, “you must specify a form in the article_custom call that is different from the form the article itself is called by, to avoid a circular reference.”

Last edited by els (2011-03-10 23:16:03)

Offline

#8 2011-03-11 00:36:14

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Article within an article

Els wrote:

When I created a sitemap in an article, as described in this TXP Tip, I found out that when using an article_custom tag in an article, “you must specify a form in the article_custom call that is different from the form the article itself is called by, to avoid a circular reference.”

OK, so that’s what I missed. I had tested it out, but using article_custom as a container tag.


Code is topiary

Offline

Board footer

Powered by FluxBB