Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
Re: Code in body_aside (form) and two sections (pages) ... ?
Really, it was the first thing I tried…
<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 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>
… but you do have to use the right quotation marks:
section="<txp:section />" has to be section='<txp:section />' … 😳
Thanks @jakob … :)
Last edited by RedFox (Today 05:53:04)
Offline