Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#21 2006-08-23 00:51:05
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Including article body inside another article
I don’t think it’s worth messing around with subversion…
I wasn’t suggesting you should, simply pointing out you’d only need a workaround for a little while.
…where one article needs to have a list of articles in another section in it. Look here…
That’s over-complicating it. All you need to do is call article_custom right after your call to article, in your page.
<txp:article form="my_section_article" />
<txp:article_custom form="the_other_articles" />
?
Offline
#22 2017-03-18 05:19:08
- alicson
- Member
- Registered: 2004-05-26
- Posts: 465
- Website
Re: Including article body inside another article
This thread came up in my search for something..
Probably this capability became possible after these posts; I remember being able to do this (call other articles from within an article) years back, and double-checked: still easily doable now. (Just call the <txp:article_custom id="X" form="your_form" />
) (Just in case anyone else searches or stumbles on this thread too in the future.)
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
#23 2017-03-18 20:23:20
- michaelkpate
- Moderator
- From: Avon Park, FL
- Registered: 2004-02-24
- Posts: 1,214
- Website
Re: Including article body inside another article
I recently ran into a situation where I needed to include aspects of the next/previous article for navigation on an article page. You can get prev_title
to get the title but I needed the article image as well. I eventually figured out how to use etc_link_to
with this method suggested by etc.
<txp:variable name="more" value='<txp:link_to_prev /><txp:link_to_next />' />
<txp:variable name="prev" value='<txp:link_to_prev />' />
<txp:variable name="next" value='<txp:link_to_next />' />
<div class="post-pagination">
<txp:if_variable name="more" value="">
<txp:else />
<txp:if_variable name="prev" value="">
<txp:else />
<txp:article_custom form="pagination-prev" id='<txp:etc_link_to target="prev" link="0">
<txp:etc_link_id /></txp:etc_link_to>' />
</txp:if_variable>
<txp:if_variable name="next" value="">
<txp:else />
<txp:article_custom form="pagination-next" id='<txp:etc_link_to target="next" link="0">
<txp:etc_link_id /></txp:etc_link_to>' />
</txp:if_variable>
</txp:if_variable>
As Alicson notes above, that lets you display whatever you need.
Offline
#24 2017-03-20 06:42:24
- alicson
- Member
- Registered: 2004-05-26
- Posts: 465
- Website
Re: Including article body inside another article
::mentally files that one for future reference:: ::would love to +1 / “like” / thumbs-up so many posts in this forum::
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
#25 2017-03-20 11:17:38
- etc
- Developer
- Registered: 2010-11-11
- Posts: 3,410
- Website
Re: Including article body inside another article
In 4.6+ this probably works to get the next/prev article id:
<txp:php>
global $thisarticle;
echo $thisarticle['next']['ID'];
echo $thisarticle['prev']['ID'];
</txp:php>
Offline
#26 2017-03-20 12:46:07
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,208
Re: Including article body inside another article
etc wrote #304931:
In 4.6+ this probably works to get the next/prev article id
Is that valid also for non-core sort values like “position” (created by stm_article_custom order)?
Last edited by uli (2017-03-20 14:30:47)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#27 2017-03-20 14:04:59
- michaelkpate
- Moderator
- From: Avon Park, FL
- Registered: 2004-02-24
- Posts: 1,214
- Website
Re: Including article body inside another article
etc wrote #304931:
In 4.6+ this probably works to get the next/prev article id:
I tested it and got:
Tag error: <txp:php> -> Notice: Undefined index: ID while parsing form pagination-next on page section
Offline
#28 2017-03-20 14:20:40
- etc
- Developer
- Registered: 2010-11-11
- Posts: 3,410
- Website
Re: Including article body inside another article
uli wrote #304937:
Is that valid also for non-core sort values like “position” (created by stm_article_custom)?
If stm_article_custom
is just creating and populating some custom field — yes, it should. Otherwise I don’t know. :-)
michaelkpate wrote #304938:
Tag error: <txp:php> -> Notice: Undefined index: ID while parsing form pagination-next on page section...
Yes, it must be $thisarticle['next']['thisid']
, sorry. And you probably have to call <txp:link_to_next />
before, to populate it.
Offline
#29 2017-03-20 14:35:21
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,208
Re: Including article body inside another article
etc wrote #304940:
If
stm_article_custom
is just creating and populating some custom field — yes, it should. Otherwise I don’t know. :-)
Yes, it does. (Uncertainty probably caused by my faulty plugin name, I meant stm_article_order
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#30 2017-03-20 15:23:57
- michaelkpate
- Moderator
- From: Avon Park, FL
- Registered: 2004-02-24
- Posts: 1,214
- Website
Re: Including article body inside another article
etc wrote #304940:
Yes, it must be
$thisarticle['next']['thisid']
, sorry.
I never like to use raw PHP code where a plugin would work just as well and is so much cleaner.
// TXP 4.6 tag registration
if (class_exists('\Textpattern\Tag\Registry')) {
Txp::get('\Textpattern\Tag\Registry')
->register('mkp_next_id')
->register('mkp_prev_id')
;
}
function mkp_next_id()
{
global $thisarticle;
return ($thisarticle['next']['thisid']);
}
function mkp_prev_id()
{
global $thisarticle;
return ($thisarticle['prev']['thisid']);
}
I actually think, though, these might be useful tags to add to 4.7.
Offline