Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2011-10-30 12:32:55
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 581
Use Custom field in conjunction with Article Custom
I have a number of articles that need to be repeated in different sections of my website. The repeated articles however need to have their own unique URLs different to that of their parent. I’d rather not have to update two articles every time I have to update one of them.
I’ve been trying to link the articles together using a custom field and a variable that I can feed into an Article Custom’s ID. So far I can get the the Title
to display but the not the body
(which is empty as I’m hoping to use the body of the parent article). If I substitute the custom field for an actual ID number everything works as planned.
Does anyone have any advice or suggestions?
<txp:variable name="link" value="<txp:custom_field name='Link_to_Article' />" />
<txp:article_custom id='<txp:variable name='link' />'>
<h1><txp:title /></h1>
<div class="content"><txp:body /></div>
</txp:article_custom>
Thanks.
Offline
Re: Use Custom field in conjunction with Article Custom
You need to use single quotes here:
<txp:variable name="link" value='<txp:custom_field name="Link_to_Article" />' />
Or you could use the tag as container:
<txp:variable name="link"><txp:custom_field name='Link_to_Article' /></txp:variable>
Beware of this: if the id
attribute of txp:article_custom
is empty, then the tag will fetch every live article on the database.
Offline
#3 2011-10-30 14:21:10
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 581
Re: Use Custom field in conjunction with Article Custom
Thank you so much. I’ve got it working now.
Offline