Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 Yesterday 18:36:31

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 820
Website

Code in body_aside (form) and two sections (pages) ... ?

In body_aside (form):

<aside class="complementary-content">
<txp:if_individual_article>
<txp:article_custom section="praktijk" sort="position asc" wraptag="ol" class="titles" label="(Artikelen)" labeltag="h4">
<li<txp:if_article_id id='<txp:article limit="1"><txp:article_id /></txp:article>'> class="active"</txp:if_article_id>><txp:permlink><txp:title /></txp:permlink></li>
</txp:article_custom>
</txp:if_individual_article>

There is another page/section (‘info’) that needs to use this form. How do I arrange that?

Last edited by RedFox (Yesterday 18:37:19)

Offline

#2 Today 02:16:11

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,337
Website GitHub

Re: Code in body_aside (form) and two sections (pages) ... ?

Check which page template your “info” section uses under Presentation › Sections and then open that template, and add:

<txp:output_form form="aside_body" />

at the appropriate place in the template where it should show.

If the form should show articles from the current section rather than from the “praktijk” section, you can alter the form as follows:

<aside class="complementary-content">
<txp:if_individual_article>
<txp:article_custom section='<txp:section />' sort="position asc" wraptag="ol" class="titles" label="(Artikelen)" labeltag="h4">
<li<txp:if_article_id> class="active"</txp:if_article_id>><txp:permlink><txp:title /></txp:permlink></li>
</txp:article_custom>
</txp:if_individual_article>
...

The main change is section='<txp:section />' to show articles from the current section, e.g. praktijk articles on the praktijk section, info articles on the info section. If you always just want praktijk articles, leave it as you have it now.

Your <txp:if_article_id>…</txp:if_article_id> section you can slightly simplify. as txp should automatically detect the current article’s id on an individual page.

Finally, you’ll need a closing </aside> tag somewhere.

EDIT: I added a PR to the docs for if_article_id, which has a slight error in the example.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB